我试图在AIX上使用以下命令从文件中删除回车(\r
),但它也删除了我的最后一行。有什么建议么?Sed脚本命令截断最后一行
sed -e 's/\r\n/\n/g' ./excprule > ./excprule.tst
命令序列:
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
编辑:用perl的做同样的事情找到一个解决办法,但想知道为什么这是行不通的。
显然,差异抱怨你的原始文件。 基本上,它说它以\ r结尾,而它应该以\ n结尾。 显然,你的sed命令没有错。 – tonio 2010-03-24 14:06:42