LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

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

Rep: Reputation: 15
Question Join all lines using sed


Hi,

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

input.txt:
mpla1
mpla2
mplampla mpla 3

output.txt:
mpla1 mpla2 mplampla mpla 3

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

Rep: Reputation: 108Reputation: 108
Read this thread:

http://www.linuxquestions.org/questi...hreadid=191121
 
Old 07-20-2004, 09:32 AM   #3
chipix
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: http://www.student.northpark.edu/pem...aq4.html#s4.27

tr?? man, unix has a lot of commands!!
 
Old 04-03-2007, 09:55 AM   #4
sredden79
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.
 
  


Reply


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 06:33 AM.

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