Computing.Net > Forums > Unix > Copy multiple lines into a line wit

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Copy multiple lines into a line wit

Reply to Message Icon

Name: squarewave
Date: May 5, 2005 at 02:49:00 Pacific
OS: Solaris
CPU/Ram: 512
Comment:

Hi,
I have a text file which looks like
aaaaaa
bbbbbb
cccccc
What should be the sed command to produce a one line output like
aaaaaa, bbbbbb, cccccc

Thank you,



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: May 5, 2005 at 04:57:42 Pacific
Reply:

Would tr work ?

tr '\012' ' ' < filename


0

Response Number 2
Name: nails
Date: May 5, 2005 at 08:45:27 Pacific
Reply:


the 'xargs echo' places everything on one line and the sed replaces each space with a comma:

cat datafile |xargs echo|sed 's/ /,/g'


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Copy multiple lines into a line wit

Script for replacing multiple lines www.computing.net/answers/unix/script-for-replacing-multiple-lines/4145.html

copy and past in a file www.computing.net/answers/unix/copy-and-past-in-a-file/8112.html

How to insert environ string into a www.computing.net/answers/unix/how-to-insert-environ-string-into-a/6182.html