使用 sed,删除两个字符之间的所有内容 [英] Using sed, delete everything between two characters

查看:118
本文介绍了使用 sed,删除两个字符之间的所有内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何删除一行中两个字符之间的符号、空格、字符、单词?

How can I delete symbols, whitespaces, characters, words everything between two characters in a line?

我的 5 行文件是:

"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1)" 120.94.30.12 264 556 -    
"Skype for Macintosh" 120.94.30.9 1038 482 -
-129.94.30.4 217 309 -
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1)" 120.94.30.8 1197 747 -
"¢¢HttpClient" 120.94.30.12 594 231 -

我想删除 "" 之间的所有内容(包括 " 字符),以便所需的输出应该是:

I want to delete everything comes in between " and " (including the " characters) so that the required output should be:

120.94.30.12 264 556 -
120.94.30.9 1038 482 -
-120.94.30.4 217 309 -
120.94.30.8 1197 747 -
120.94.30.12 594 231 -

推荐答案

你的意思是这样?

sed 's/"[^"]*"//' file

这篇关于使用 sed,删除两个字符之间的所有内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆