[lug] Stripping whitespace in a shell script

Riggs, Rob RRiggs at doubleclick.net
Wed Feb 20 09:46:54 MST 2002


I'm looking for an effecient way to strip whitespace from the trailing end
of a line of text in a shell script.

I was using "awk '{print $1}'", but it breaks down when there is embedded
whitespace in the text, spitting out only the portion prior to the first
embedded whitespace. While whitespace should not be embedded, it occurs
frequently enough that I need to deal with it. 

Any suggestions on how to do it in Bash script?

-Rob





More information about the LUG mailing list