从文件

时间:2016-08-01 12:26:19

标签: linux shell

我这样做了

'< Jan 20 Sep> This is the sample out put
This is Sample
>

'< Jan 21 Sep> This is the sample out put
This is Known Errors
>

所以我需要删除所有&gt;文件中的特殊字符。只有一个特殊字符的行&gt;存在需要删除。
我想将下面的内容放在

'< Jan 20 Sep> This is the sample out put
This is Sample
'< Jan 21 Sep> This is the sample out put
This is Known Errors

2 个答案:

答案 0 :(得分:3)

您可以使用sed

sed '/^>$/d' myfile

如果输出对您有用,您可以使用-i标记覆盖您的文件:

sed -i '/^>$/d' myfile

答案 1 :(得分:0)

grep -fvx '>' <myfile >myfile_with_offending_lines_removed