示例输入:
2234 1233 5678 8876 9009 3444
2222 3454 5667 7878 4554 3222输出:
xyzw 1233 5678 8876 9009 xyzw
xyzw xyzw 5667 7878 4554 xyzw我使用的是这个查询:perl -pe 's/^[2-4]+/abcd/g',但是没有给我想要的输出。
发布于 2016-12-05 22:52:46
因为它只是运行一个正则表达式,所以您可以直接和更快地使用sed:
sed 's/\b\([2-3][0-9][0-9][0-9]\|4000\)\b/xyzw/g' input请注意,考虑到@roaima的评论,我更新了它。
https://unix.stackexchange.com/questions/328273
复制相似问题