小编tan*_*ngi的帖子

使用Sed和Regex替换字符串

我正在尝试使用sed但使用正则表达式取消注释文件内容(例如:[0-9] {1,5})

# one two 12
# three four 34
# five six 56
Run Code Online (Sandbox Code Playgroud)

以下是有效的:

sed -e 's/# one two 12/one two 12/g' /file
Run Code Online (Sandbox Code Playgroud)

但是,我想要的是使用正则表达式模式替换所有匹配而不输入数字但保留结果中的数字.

regex string bash replace sed

20
推荐指数
2
解决办法
7万
查看次数

标签 统计

bash ×1

regex ×1

replace ×1

sed ×1

string ×1