[SGVLUG] Shell fun: cutting the last field of a record...

Emerson, Tom Tom.Emerson at wbconsultant.com
Fri Mar 24 13:23:05 PST 2006


> -----Original Message-----
> [mailto:sgvlug-bounces at sgvlug.net] On Behalf Of Bryan D Howard
> 
> "Emerson, Tom" <Tom.Emerson at wbconsultant.com> writes:
> >    filea
> >    fileb
> >    filec\015
> 
> Interesting.  That matches the output of 'ls -1b' on my 
> Solaris box.

(actually, this was on an AIX system using the korn shell...)

> You can run the string through tr(1) to remove any characters 
> you don't want.  And you can either specify a list to get rid of:
> 
>     $ echo $whatever | tr -d "\015"
> 

That's two suggestions for "tr", so that looks like a winner

Thanks guys!

Tom


More information about the SGVLUG mailing list