Remove lonely newline
Hi
I would like to remove all lonely newlines from a text file. By that I mean that this text: Code:
a a a Code:
a a a b b b c c c Code:
cat "$1" |tr "\n" "@"| sed 's/@@/\n/g'|sed 's/@/ /g' |
Just an idea in awk:
Code:
/./ { string = string " " $0 } |
Didn't read the whole question.
http://www.student.northpark.edu/pem...d/sed1line.txt This file still kicks ass. |
Colucix, yeah, I kinda suck at gawk. How would I implement it? If I have a textfile foo.txt that I would want that awk code to work on, how would I do?
|
To execute awk code you can put it in a file and execute with the -f option, as in
Code:
gawk -f program.awk foo.txt Code:
gawk '{print $1}' foo.txt |
Sweet! Thanks a lot!
|
All times are GMT -5. The time now is 09:05 PM. |