仅在特定行之间使用 sed [英] Using sed between specific lines only

查看:37
本文介绍了仅在特定行之间使用 sed的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个 sed 命令来删除逗号后的空格.

I have this sed command for removing the spaces after commas.

 sed -e 's/,\s\+/,/g' example.txt

我该如何更改它,它只会在特定行号之间进行修改.

How can i change it that, it will make the modification between only specific line numbers.

(例如在第二行和第三行之间).

(e.g. between second and third lines).

推荐答案

使用:

sed '2,3s/,\s\+/,/g' example.txt

这篇关于仅在特定行之间使用 sed的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆