我想从每行中删除“/”并添加空格而不是“/”
输入示例:
7 47562385 47562385 ctttttttttttttttt/cttttttttttttttt
11 48932150 48932150 C/A
6 87733066 87733066 caaaaaaaaaaaaaaaaaaaaaa/cAAaaaaaaaaaaaaaaaaaaaaaa
8 4056078 4056078 cttttttttttttttttttttt/cTTttttttttttttttttttttt
我想要这样的输出
7 47562385 47562385 ctttttttttttttttt cttttttttttttttt
1 48932150 48932150 C A
6 87733066 87733066 caaaaaaaaaaaaaaaaaaaaaa cAAaaaaaaaaaaaaaaaaaaaaaa
8 4056078 4056078 cttttttttttttttttttttt cTTttttttttttttttttttttt
您可以使用 grep 和 sed 的组合来将输入文件的每一行中所有出现的 / 替换为空格。
grep . input.txt | sed 's/\// /g
如果要将输出保存到新文件,可以重定向输出:
grep . input.txt | sed 's/\// /g' > output.txt
通常你可以只使用查找和替换,但如果你的场景不同,你需要以更详细的方式说明。