替换连续2个模式

时间:2016-01-28 07:07:53

标签: linux unix awk sed

输入文件:

var elements = $('*').filter(function () { 
    return this.style.position == 'fixed';
});

预期输出文件:

101|12345|Stephen Lawrence\|Sam|02/02/16

102|12346|Michael\|Point|03/02/16

103|12347|Peter Man|01/02/16

想要删除名称之间的101|12345|Stephen Lawrence Sam|02/02/16 102|12346|Michael Point|03/02/16 103|12347|Peter Man|01/02/16

尝试:

"\|"

但没有预期的输出。

有任何输入吗?

2 个答案:

答案 0 :(得分:2)

 sed 's/\\|/ /g' File

输出:

101|12345|Stephen Lawrence Sam|02/02/16

102|12346|Michael Point|03/02/16

103|12347|Peter Man|01/02/16

答案 1 :(得分:0)

awk '{sub(/e\\\|S/,"e S")sub(/l\\\|P/,"l P")}1' file

101|12345|Stephen Lawrence Sam|02/02/16

102|12346|Michael Point|03/02/16

103|12347|Peter Man|01/02/16