linux-tutorial/codes/shell/查找替换文本/sed/跳转.sh

8 lines
277 B
Bash
Raw Normal View History

2019-10-29 18:22:19 +08:00
#!/usr/bin/env bash
2019-05-10 11:17:57 +08:00
#跳转到指定脚本
sed '{/first/b jump1; s/This is the/No jump on/; :jump1; s/This is the/Jump here on/}' test
#跳转到开头,删除每一个逗号,并保证删除最后一个逗号之后,跳出循环
sed -n '{:start; s/,//1p; /,/b start}' test