[lug] Stripping whitespace in a shell script

Riggs, Rob RRiggs at doubleclick.net
Wed Feb 20 10:20:10 MST 2002


That appears to work. I can't believe I didn't try that earlier. Thanks!

-----Original Message-----
From: lug-admin at lug.boulder.co.us [mailto:lug-admin at lug.boulder.co.us]
Sent: Wednesday, February 20, 2002 10:14 AM
To: lug at lug.boulder.co.us
Subject: Re: [lug] Stripping whitespace in a shell script


On Wed, Feb 20, 2002 at 10:04:46AM -0700, Riggs, Rob wrote:
> Thanks Chip. But that sed script will only strip spaces. I'm looking to
> strip all whitespace, not just " ", but also newlines, tabs, etc.

How about:

  sed -e 's/[\n\t\r ]*$//'

You can insert all sorts of characters into the '[  ... ]' construct,
depending on your dfinition of whitespace.



More information about the LUG mailing list