sed '$d' source_file.dat > destination_file.dat
However, there was a catch - the last line in the file had a "\n" character at the end. The above code removed the last line but kept the newline character intact!
I verified this behavior with the command "wc -l" and that too ignored this newline character.
So after a lot of struggle, I still could not get rid of the extra newline character ...
If you find a solution for this - please let me know - thanks!
BTW, here is a link to a set of very useful one-line sed scripts on the sed sourceforge site.
No comments:
Post a Comment