I have a somewhat bizarre problem when trying to concatenate lines in a file.
Using
cat file.txt | sed -e :a -e '/$/N;s/\n/ /;ta'
the output in file.txt should go from
1
2
3
to
1 2 3
instead I only get the last line or
3
.
I find that if I open the file in gedit and hit delete in front of every line the code works. I don't believe there are any spaces in front of the lines and the code should still work even if there were. What is going wrong? How do I go about fixing this?
does not work isn't very good response. Show all you have got. error messages etc... if your actual file is not the same as what you posted, then how do you expect to get correct results when people actually work on your sample file?