LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   how to remove lf from a text file (https://www.linuxquestions.org/questions/linux-software-2/how-to-remove-lf-from-a-text-file-493973/)

gfem 10-19-2006 06:31 PM

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

cjcox 10-19-2006 06:36 PM

perl -pi -e 's/\012//' file.txt

vls 10-19-2006 06:36 PM

\r is a Carriage Return; LF is \n

rickh 10-19-2006 06:41 PM

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


All times are GMT -5. The time now is 03:22 AM.