[ale] sed & newline removal

Lathe magius at wittsend.com
Thu Apr 18 11:49:01 EDT 2002



Hey all,
I'm working with sed to create a .csv file from a 
list of file in a directory.  Each of those files contains configuration 
values like look like this:
 
name=value
name2=value2
 
now I've gotten to a point where commas are placed 
at the end of the line for each name/value pair by using the 
following:
 
cat * | sed -e 's/$/,/3'
 
I'd now like to take 3 lines and make them one 
line, such as:
 
name1=value1, name2=value2, name3=value3
name4=value4, name5=value5, 
name6=value6
 
By what I've read, the following should work:
 
cat * | sed -e ':!$N;s/\n/,/3'
 
However, the results are less than optimistic.  Any thoughts on what I 
might be doing incorrectly?  I'm thinking that it must have something 
to do with the N operation takes multiple lines and places them into the 
namespace for checking by sed.  
 
Thanks in advance
 
--Scott Warfield




More information about the Ale mailing list