LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 06-15-2009, 08:28 AM   #1
yuanjunliang
LQ Newbie
 
Registered: Apr 2009
Posts: 22

Rep: Reputation: 0
Combine the Carriage Returns into one line


I want to remove the "\+ Carrige Return" in the following text file:

id|column1|column2|comment|
1|aaa|bbb|he is great|
2|aa2|bb2|she is good|
3|aa3|bb3| fgf\
fgf\
gg|
4|aa4|bb4|bbb\
nnn\|
5|aa5|bb5|gggg|


After convert:

id|column1|column2|comment|
1|aaa|bbb|he is great|
2|aa2|bb2|she is good|
3|aa3|bb3| fgf fgf gg|
4|aa4|bb4|bbb nnn|
5|aa5|bb5|gggg|
 
Old 06-15-2009, 08:37 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Code:
sed -i.bck -e :label -e '/\\$/N; s/\\\n/ /; t label' file
 
Old 06-15-2009, 09:04 AM   #3
yuanjunliang
LQ Newbie
 
Registered: Apr 2009
Posts: 22

Original Poster
Rep: Reputation: 0
Colucix, Thank you very much.
 
  


Reply



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
adding carriage returns Zxarr Programming 7 09-20-2005 05:44 AM
Carriage Returns Thorkyl Linux - Software 7 06-28-2004 05:42 PM
XDrawString and carriage returns jpbarto Programming 1 03-25-2004 03:07 PM
Kword: How to remove carriage returns? RockyRed Linux - Newbie 1 07-21-2003 06:52 AM
Carriage Returns Trouble sancho5 Linux - General 2 08-29-2001 08:59 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:46 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration