标签:and oldboy pre iar min teacher like int http
问题1:输出oldboy. txt的第2-3行内容※。1、输出oldboy. txt的第2-3行内容※。
[root@oldboyedu ~/test]# sed –n ‘2,3p’oldboy.txt
I teach linux.
2、过滤出含有oldboy字符串的行※。
[root@oldboyedu ~/test]# sed -n ‘/oldboy/p‘ oldboy.txt
I am oldboy teacher!
our site is http://www. oldboyedu.com
mv god,i am not oldboy,but OLDBOY!
3、删除含有oldboy字符串的行※。
[root@oldboyedu ~/test]# sed ‘/oldboy/d‘ oldboy.txt
I teach linux.
I like badminton ball,billiard ball and chinese chess!
mv qq num is 49000448
not 490000448
4、将文件中的oldboy字符串全部替换为oldgirl※。
[root@oldboyedu ~/test]# sed ‘s#oldboy#oldgirl#g‘ oldboy.txt
I am oldgirl teacher!
I teach linux.
I like badminton ball,billiard ball and chinese chess!
our site is http://www. oldgirledu.com
mv qq num is 49000448
not 490000448
mv god,i am not oldgirl,but OLDBOY!
5、将文件中的oldboy字符串全部替换为oldgirl,同时将QQ号码49000448改为31333741.
[root@oldboyedu ~/test]# sed -e ‘s#oldboy#oldgirl#g‘ -e ‘s#49000448#31333741#g‘ oldboy.txt
I am oldgirl teacher!
I teach linux.
I like badminton ball,billiard ball and chinese chess!
our site is http://www. oldgirledu.com
mv qq num is 31333741
not 490000448
mv god,i am not oldgirl,but OLDBOY!
标签:and oldboy pre iar min teacher like int http
原文地址:https://blog.51cto.com/14839954/2506989