Saturday, October 25, 2008

Joining lines

Hi linuxurs,

How can i join lines in a file based of a particular char at the end of a line. eg,
contents of the file text.txt is as follows, need to join lines which end with ','
cat
bat,
eat,
some
help

The output should be as follows.
cat
bat,eat,some
help

Please help to do this with a perl, awk or sed one linner.

Welcome To linuxurs

Welcome to our small step towards sharing knowledge and contributing to opensource community.