LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 10-19-2006, 06:31 PM   #1
gfem
Member
 
Registered: Apr 2003
Distribution: Fedora
Posts: 126

Rep: Reputation: 15
how to remove lf from a text file


I need help removing LF from a text file. I have a file I want to turn into one long line of data, but I can not figure out how to do it, I have tried...
cat file.txt | perl -pe 's:\r::g' > file2.txt
but no luck. I also tried...
sed 's/r//g' filename.txt >newfile.txt
with no luck.

any help is appreciated.

-Gregg
 
Old 10-19-2006, 06:36 PM   #2
cjcox
Member
 
Registered: Jun 2004
Posts: 286

Rep: Reputation: 34
perl -pi -e 's/\012//' file.txt
 
Old 10-19-2006, 06:36 PM   #3
vls
Member
 
Registered: Jan 2005
Location: The grassy knoll
Distribution: Slackware,Debian
Posts: 192

Rep: Reputation: 30
\r is a Carriage Return; LF is \n
 
Old 10-19-2006, 06:41 PM   #4
rickh
Senior Member
 
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 57
You could open the file in any text editor, and do a "replace" of all occurences of \n
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
remove \r and \n from a text file powah Programming 9 10-02-2006 06:02 AM
remove some text from a file hfawzy Programming 7 07-10-2006 09:22 PM
remove text from file with script paul_mat Linux - Software 3 11-17-2005 12:21 PM
Remove odd lines from a text file Mr. Gone Programming 2 09-19-2005 11:16 AM
How to remove line of text from file netkepala Linux - General 2 05-23-2003 11:49 AM


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

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