我有一个以推文形式出现的文本文件,但在删除完整网址时遇到了问题。文本文件的示例:
index.html
:
this is a tweet that has info. http://google.com
this is a tweet that has an image. pic.twitter.com/a2y4H1b2Jq
我想创建一个只有以下内容的新文件:
this is a tweet that has info.
this is a tweet that has an image.
现在我正在与grep合作,我有
grep -oP "http://\K[^']+" final.txt
谢谢!
sed 's/http[^ ]*//g' YourFile
[^] *正在捕获所有非空白字符
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句