in reply to chomp a newline in awk
Ewww. awk.
gsub( "\n", "" );
will remove all newlines in $0, if that's what you're looking for. I suppose you could anchor it with $
gsub( /\n$/, "" );
to be more like chomp.
update: Oops! Looks like a is right. I based my assertion on the fact that
% cat foo | awk '{ gsub(/\n$/,""); printf("%s", $0); }'printed out foo as a single line. But take out the gsub and you're okay too. Oh well.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: chomp a newline in awk
by a (Friar) on Jan 18, 2001 at 10:01 UTC |