文字改寫的好幫手
文字替換
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@rhel7 ~]# echo abcd |sed s/a/z/ | |
zbcd | |
#文字替換 | |
[root@rhel7 ~]# echo "abcd" |sed "s/a/z/" | |
zbcd | |
#引號 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@rhel7 ~]# echo old old | sed s/old/new/g | |
new new | |
#文字替換 | |
[root@rhel7 ~]# echo "abcd" |sed "s/a/z/" | |
zbcd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@rhel7 ~]# echo "this is bad" | sed 's/bad/good/w out.txt' | |
this is good | |
#替換文件內文字 | |
[root@rhel7 ~]# cat out.txt | |
this is good | |
#查看結果 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@rhel7 ~]# echo "今天心情很差" | sed s/差/好/g | |
今天心情很好 | |
#中文範例 |
沒有留言:
張貼留言