从文件中删除带有字符的行(Remove lines with the character from the file)
我这样说了
'< 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 >所以我需要从文件中删除所有>特殊字符。 只需要删除存在一个特殊字符>的行。 我想在下面说出来
'< Jan 20 Sep> This is the sample out put This is Sample '< Jan 21 Sep> This is the sample out put This is Known ErrorsI have out put like this
'< 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 >So i need to remove all > special character from the file. Only the line where one special character > is present needs to be removed. I would like to have below out put
'< 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最满意答案
你可以使用sed
sed '/^>$/d' myfile如果输出对你有好处,你可以使用-i标志来覆盖你的文件:
sed -i '/^>$/d' myfileYou can use sed
sed '/^>$/d' myfileIf the output if good for you, you can use the -i flag to override your file:
sed -i '/^>$/d' myfile更多推荐
发布评论