[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