Hi there!
This sounds like such a simple task, yet I haven't succeeded so far... I have some standard, not-so-long linux text file, say, readme.txt, and I want to delete all new lines (\n). How can this be so difficult?
I tried
Code:
cat readme.txt | sed s/"\n"/""/
but this doesn't work. I guess, that's because sed reads only one line per go? So I could use
Code:
cat readme.txt | sed 'N;s/\n//'
which would join adjacent lines all right. But, of course, to replace all line breaks, I would have to do this more often
Code:
cat readme.txt | sed 'N;s/\n//' | sed 'N;s/\n//' | sed 'N;s/\n//' | ...
or even put a loop around it. But this seems so difficult!
Ain't there any better way?
(actually, what I want to do is to replace the standard "You have Mail in /var/spool/..." message by "You have Mail from Tom, Andi, Sue". So I'm looking for a fast one-liner
)
Cheers,
Bkeeper