转载请注明出处 http://www.paraller.com 原文排版地址 点击获取更好阅读体验
hello hello world world
$ echo 'hello hi world world' | awk '{printf "%-20s%-20s\n%-20s%-20s\n",$1,$2,$3,$4}' | sed "/hi/ a add hi line" hello hi add hi line world world ```
c
命令是替换匹配行 $ echo 'hello hi world world' | awk '{printf "%-20s%-20s\n%-20s%-20s\n",$1,$2,$3,$4}' | sed "2 c replace line 2" hello hi replace line 2
d
删除匹配行 $ echo 'hello hi world world' | awk '{printf "%-20s%-20s\n%-20s%-20s\n",$1,$2,$3,$4}' | sed "2 d" hello hi $ echo 'hello hi world world' | awk '{printf "%-20s%-20s\n%-20s%-20s\n",$1,$2,$3,$4}' | sed "/hi/ d" world world