[SGVLUG] Shell fun: cutting the last field of a record...
John E. Kreznar
jek at ininx.com
Fri Mar 24 12:40:50 PST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
"Emerson, Tom" <Tom.Emerson at wbconsultant.com> writes:
> I've got a process that is extracting the name as follows:
> for REC in `cat worklist`
> do
> fname=`echo $REC | cut -f6 -d"|"`
> <does something thaqt creates the file "$fname">
> done
> Say for instance the file "worklist" looks like this:
> rec1|field2|field3|field4|field5|filea
> rec2|field2|field3|field4|field5|fileb
> rec3|field2|field3|field4|field5|filec^M (file has an embedded
> carraige return at the end)
> how can I eliminate that trailing "/r" ?
Maybe selectively delete all CRs:
fname=`echo $REC | tr -d '\015' | cut -f6 -d"|"`
- --
John E. Kreznar jek at ininx.com 9F1148454619A5F08550 705961A47CC541AFEF13
Operating a computer with a GUI is like driving a car with
an animated cartoon in place of the clear front window.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.6 <http://mailcrypt.sourceforge.net/>
iD8DBQFEJFlGYaR8xUGv7xMRAomQAJ95Lc5AifgCxMBwL8bp4dqtNsvJ1gCeM+nS
99Lhpo7unzepyjkv2v5jM8k=
=JnyT
-----END PGP SIGNATURE-----
More information about the SGVLUG
mailing list