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

Dustin Laurence dustin at dogbert.laurences.net
Fri Mar 24 14:39:54 PST 2006


On Fri, Mar 24, 2006 at 01:23:05PM -0800, Emerson, Tom wrote:

> >     $ echo $whatever | tr -d "\015"
> > 
> 
> That's two suggestions for "tr", so that looks like a winner

My vote would be to *only* let through [a-zA-Z0-9_.] or something like
that, to avoid some future surprise when you forgot to disallow some
wierd character.

Depending on exact needs you could also substitute '_' or 'X' for every
disallowed character, to avoid accidental collisions.  That probably
isn't needed for this particular app, but it's a thought.  Ideally
you'd use a character you don't otherwise allow so there is no confusion
between 'X\015' and 'XX'.

Dustin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.sgvlug.net/pipermail/sgvlug/attachments/20060324/98b93376/attachment.bin


More information about the SGVLUG mailing list