linux之shell 其他
去除重複出現的字元
oracle@ser168:~/qilin/demo> cat oops.txt
And the cowwwwws went homeeeeeeeeeeeeeeeeeeeeeeeee
Or did theYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
oracle@ser168:~/qilin/demo> tr -s "[a-z],[A-Z]"
Or did theY
刪除空行
oracle@ser168:~/qilin/demo> cat plane.txt
kfalfkafa sdfadfa
dfaflakfalf liqilin
43314141 zhuauang
fdafaflaf dfafkalf
5422422 li
oracle@ser168:~/qilin/demo> tr -s "[\012]"
dfaflakfalf liqilin
43314141 zhuauang
fdafaflaf dfafkalf
5422422 li
oracle@ser168:~/qilin/demo> tr -s ["\n"]
dfaflakfalf liqilin
43314141 zhuauang
fdafaflaf dfafkalf
5422422 li
大寫到小寫
oracle@ser168:~/qilin/demo> cat oops.txt
And the cowwwwws went homeeeeeeeeeeeeeeeeeeeeeeeee
Or did theYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
oracle@ser168:~/qilin/demo> cat oops.txt | tr "[A-Z]" "[a-z]" >lower_oopst.txt
oracle@ser168:~/qilin/demo> cat lower_oopst.txt
and the cowwwwws went homeeeeeeeeeeeeeeeeeeeeeeeee
or did theyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
小寫到大寫
oracle@ser168:~/qilin/demo> cat oops.txt
And the cowwwwws went homeeeeeeeeeeeeeeeeeeeeeeeee
Or did theYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
oracle@ser168:~/qilin/demo> cat oops.txt | tr "[a-z]" "[A-Z]" >upper_oopst.txt
oracle@ser168:~/qilin/demo> cat upper_oopst.txt
AND THE COWWWWWS WENT HOMEEEEEEEEEEEEEEEEEEEEEEEEE
OR DID THEYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
刪除指定字元
oracle@ser168:~/qilin/demo> cat diary.txt
monday 10:50
Tuserday 15:50
wednesday 12;30
THURDAY 10;20
Friday 06:34
oracle@ser168:~/qilin/demo> tr -cs "[a-z][A-Z]" "[\012*]"
Tuserday
wednesday
THURDAY
Friday
轉換控制字元
去除重複出現的字元
oracle@ser168:~/qilin/demo> cat oops.txt
And the cowwwwws went homeeeeeeeeeeeeeeeeeeeeeeeee
Or did theYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
oracle@ser168:~/qilin/demo> tr -s "[a-z],[A-Z]"
Or did theY
刪除空行
oracle@ser168:~/qilin/demo> cat plane.txt
kfalfkafa sdfadfa
dfaflakfalf liqilin
43314141 zhuauang
fdafaflaf dfafkalf
5422422 li
oracle@ser168:~/qilin/demo> tr -s "[\012]"
dfaflakfalf liqilin
43314141 zhuauang
fdafaflaf dfafkalf
5422422 li
oracle@ser168:~/qilin/demo> tr -s ["\n"]
dfaflakfalf liqilin
43314141 zhuauang
fdafaflaf dfafkalf
5422422 li
大寫到小寫
oracle@ser168:~/qilin/demo> cat oops.txt
And the cowwwwws went homeeeeeeeeeeeeeeeeeeeeeeeee
Or did theYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
oracle@ser168:~/qilin/demo> cat oops.txt | tr "[A-Z]" "[a-z]" >lower_oopst.txt
oracle@ser168:~/qilin/demo> cat lower_oopst.txt
and the cowwwwws went homeeeeeeeeeeeeeeeeeeeeeeeee
or did theyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
小寫到大寫
oracle@ser168:~/qilin/demo> cat oops.txt
And the cowwwwws went homeeeeeeeeeeeeeeeeeeeeeeeee
Or did theYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
oracle@ser168:~/qilin/demo> cat oops.txt | tr "[a-z]" "[A-Z]" >upper_oopst.txt
oracle@ser168:~/qilin/demo> cat upper_oopst.txt
AND THE COWWWWWS WENT HOMEEEEEEEEEEEEEEEEEEEEEEEEE
OR DID THEYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
刪除指定字元
oracle@ser168:~/qilin/demo> cat diary.txt
monday 10:50
Tuserday 15:50
wednesday 12;30
THURDAY 10;20
Friday 06:34
oracle@ser168:~/qilin/demo> tr -cs "[a-z][A-Z]" "[\012*]"
Tuserday
wednesday
THURDAY
Friday
轉換控制字元
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20976446/viewspace-684542/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- linux之shell findLinux
- Linux之shell變數Linux變數
- Linux Shell之表示式Linux
- Linux Shell 之 我的第一個Shell程式Linux
- Linux之shell程式設計Linux程式設計
- Linux Shell之sort命令(轉)Linux
- linux之shell命令之一Linux
- linux之shell awk 之一Linux
- linux之shell awk 之二Linux
- Linux學習之(shell展開)Linux
- linux之shell 輸入輸出Linux
- Linux基礎之Shell與變數Linux變數
- [linux shell]引數傳遞之空格Linux
- Linux&shell 之Linux檔案許可權Linux
- linux shell下除了某個檔案外的其他檔案全部刪除的命令Linux
- Linux ShellLinux
- Linux Shell檔案之間的包含關係Linux
- Linux作業系統之Shell程式設計Linux作業系統程式設計
- Linux/Unix shell sql 之間傳遞變數LinuxSQL變數
- linux shell之do done及for 迴圈指令碼Linux指令碼
- Linux 程式設計之Shell程式設計(轉)Linux程式設計
- 我從其他Shell指令碼中學到了什麼?指令碼
- 9、在Shell指令碼中呼叫其他指令碼指令碼
- shell實戰之Linux主機系統監控Linux
- Linux之19——Shell程式設計基礎詳解Linux程式設計
- linux下的shell程式設計之--擷取字串Linux程式設計字串
- linux shell helloworldLinux
- 強大好用的shell之shell命令
- Linux Shell程式設計(27)——子shellLinux程式設計
- linux shell 指令碼之深入淺出的grep的用法Linux指令碼
- Spark之spark shellSpark
- 我從其他人的Shell指令碼中學到的指令碼
- Linux shell日常使用Linux
- Linux Shell變數Linux變數
- Linux Shell指令碼Linux指令碼
- Linux shell 基礎Linux
- Linux shell迴圈Linux
- linux shell重定向Linux