AWK/SED 删除包含括号的列
我想知道是否可以删除数据文件中包含可以包含在任何列中的任何括号的列。例如
...
John Doe (Tech Department) 09/12/2009 555-555-5555
Jane Smith 09/12/2009 555-555-5555 (Suspended)
Alfred doe 555-555-5555 (Vacation) 09/09/2011
...
,那么我希望输出看起来像
...
John Do 09/12/2009 555-555-5555
Jane Smith 09/12/2009 555-555-5555
Alfred doe 555-555-5555 09/09/2011
...
我正在考虑对括号之间的文本使用通配符?像/(*)/之类的东西?
感谢您的帮助,
托梅克
I was wondering if it would be possible to remove columns within a data file that contain any parenthesis that can be contained in ANY column. For example
...
John Doe (Tech Department) 09/12/2009 555-555-5555
Jane Smith 09/12/2009 555-555-5555 (Suspended)
Alfred doe 555-555-5555 (Vacation) 09/09/2011
...
So then I would like the output to look like
...
John Do 09/12/2009 555-555-5555
Jane Smith 09/12/2009 555-555-5555
Alfred doe 555-555-5555 09/09/2011
...
I was thinking of using a wildcard for the text in between the parenthesis? something like /(*)/ ?
Thanks for any help,
Tomek
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果 Perl 没问题,你可以这样做:
If Perl is okay, you can do:
最简单的是一行
sed
命令:The simplest is a one-line
sed
command: