Subject: Re: Sed Bug ?
To: None <>
From: James K. Lowden <>
List: tech-userlevel
Date: 02/02/2007 00:33:42
Stephane Engel wrote:
> I'm trying to merge all the line of a text file in a single line
> separate by a "#".
> The following GNUsed (from pkgsrc) script just work fine:
>     gsed -e ":a;" -e "$!N;s/\n/#/;ta;" < $FILE_IN > $FILE_OUT
> the same script with our sed return nothing (empty file/output)
>     sed -e ":a;" -e "$!N;s/\n/#/;ta;" < $FILE_IN > $FILE_OUT
>     Doing some more testing, it's seem for me that our sed is not able
> to join the last line.

My sed man page says "You can't, however, use a literal newline character
in an address or in the substitute command."  

However, this works:

	while read line
		printf '%s' $line
	done <  $FILE_IN \
	| xargs printf '%s#\n' > $FILE_OUT