Register a domain and help support LQ
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-20-2004, 09:02 AM   #1
LQ Newbie
Registered: Dec 2002
Location: Athens, HELLAS
Distribution: Fedora Core 4
Posts: 22

Rep: Reputation: 15
Question Join all lines using sed


what is the proper sed command in order to transform a multi-line file to a single line. For example:

mplampla mpla 3

mpla1 mpla2 mplampla mpla 3

Old 07-20-2004, 09:24 AM   #2
Senior Member
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 110Reputation: 110
Read this thread:
Old 07-20-2004, 09:32 AM   #3
LQ Newbie
Registered: Dec 2002
Location: Athens, HELLAS
Distribution: Fedora Core 4
Posts: 22

Original Poster
Rep: Reputation: 15
Oh thx.

I did not know that my question was already answered.

However, I found also this solution:

tr?? man, unix has a lot of commands!!
Old 04-03-2007, 09:55 AM   #4
LQ Newbie
Registered: Apr 2007
Posts: 1

Rep: Reputation: 0
to spell this out for everyone the command you need to use to remove all the new line characters using sed is :

sed -e :a -e '$!N; s/\n/ /; ta' test.txt

hope this helps.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Merge lines in a file using sed arobic Programming 8 01-20-2012 02:11 PM
Help using 'net join' to join a windows domain Wapo Linux - Networking 1 04-28-2006 02:30 AM
printer printing vertical lines at beginning and end of lines makhand Linux - Hardware 0 09-02-2005 02:03 PM
Removing duplicate lines with sed tireseas Programming 10 01-12-2005 03:27 AM
replacement with sed: replace pattern with multiple lines Hcman Programming 5 11-18-2004 07:40 AM

All times are GMT -5. The time now is 11:00 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration