方法:
sed -i "/ztj/iwhere" ztj.txt
root@logstash ~]# cat ztj.txt
linuxstudy
linux/home1 ztj1study
linux/home ztjstudy
linuxdastudy
linux/home2 ztj2study
linux/home3 ztj3study
linux/home4 ztj4study
[root@logstash ~]# sed -i "/ztj/iwhere" ztj.txt
[root@logstash ~]# cat ztj.txt
linuxstudy
where
linux/home1 ztj1study
where
linux/home ztjstudy
linuxdastudy
where
linux/home2 ztj2study
where
linux/home3 ztj3study
where
linux/home4 ztj4study
[root@logstash ~]#