使用awk或者sed来删除领域的斜线 [英] Using sed or awk to delete slash from fields
本文介绍了使用awk或者sed来删除领域的斜线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想任何的去除任何斜线|之间\\ \\其中包括一个名称
10.46 | 5060 | 100002366551140 | \\瓦普纳|中号\\ | 100002366551750
所需的输出
10.46 | 5060 | 100002366551140 |瓦普纳M | 100002366551750
在使用awk或者sed,你的帮助是非常AP preciated :)
解决方案
$猫文件
10.46 | 5060 | 100002366551140 | \\瓦普纳|中号\\ | 100002366551750$ sed的'S / \\\\\\([^ \\\\] * \\)| \\([^ \\\\] * \\)\\\\ / \\ 1 \\ 2 /'文件
10.46 | 5060 | 100002366551140 |瓦普纳M | 100002366551750
如果你不想删除\\S,只需将他们的括号内。
I'm trying to remove any slashes between any | between \ \ which include a name'
10.46|5060|100002366551140|\WAPNER| M\ |100002366551750
Desired output
10.46|5060|100002366551140|WAPNER M |100002366551750
while using sed or awk , your help is highly appreciated :)
解决方案
$ cat file
10.46|5060|100002366551140|\WAPNER| M\ |100002366551750
$ sed 's/\\\([^\\]*\)|\([^\\]*\)\\/\1\2/' file
10.46|5060|100002366551140|WAPNER M |100002366551750
If you don't want to remove the "\"s, just move them inside the parentheses.
这篇关于使用awk或者sed来删除领域的斜线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文