Sed script command truncating last line

Posted by C. Ross on Stack Overflow See other posts from Stack Overflow or by C. Ross
Published on 2010-03-24T13:51:34Z Indexed on 2010/03/24 13:53 UTC
Read the original article Hit count: 247

Filed under:
|
|

I'm trying to remove the carriage returns (\r) from a file with the following command on AIX, but it's also removing my last line. Any suggestions?

sed -e 's/\r\n/\n/g' ./excprule > ./excprule.tst

Command sequence:

dev1:> sed -e 's/\r\n/\n/g' ./test_file > ./test_file.tst
dev1:> diff test_file.tst test_file
diff: 0653-827 Missing newline at the end of file test_file.
26a27
> Trailer 25

© Stack Overflow or respective owner

Related posts about aix

Related posts about sed