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

8 lines
269 B
Bash
Raw Normal View History

2019-05-10 11:17:57 +08:00
#!/bin/bash
#跳转到指定脚本
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