Pipeline 與 重定向

1.<

python read-input.py < nums-0-999 

2.> >>

ls /home/jackiechen/ >home.txt
ls /home/jackiechen/ >>home.txt
cat < foo > foo //Attention 
cat < foo >> foo //Attention 

3.head tail

head -n 3 table //head -n -2 table 
tail -n 3 table
head -n 3 table|tail -n 2

4.tr

tr -s "\n" <bad-new-line >good-new-line

5.sort

cat pumpkinsizes |tail -n +3|sort -n -t '|' -k2 -r|head -n 3
cat pumpkinsizes |tail -n +3|sort -n -t '|' -k2|head -n 2

6.uniq

cat words|tr [:space:] "\n"|tr [:punct:] "\n"|tr -s "\n"|sort |uniq >words-sorted 
cat words|tr [:space:] "\n"|tr [:punct:] "\n"|tr -s "\n"|sort |uniq -cd |sort -n -k1 > words-count 

7.cut

 wc -w words|cut -d " " -f 1

8.join

join <( cat pumpkinsizes|tail -n +2|sort) <( cat emails |sort)
join <( cat pumpkinsizes|tail -n +2|sort) <( cat emails |sort)|tr -d "|" |sort -k2 -nr|head -n1|cut -d " " -f 3
grep "[0-9]$" pumpkinsizes |sort -k2 -t '|' -n|tail -n 1 >winer |join emails winer|cut -d " " -f 2


9.sed
10.awk
11.tee
12.comm
13.grep

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 系統(tǒng)巡檢腳本:Version 2016.08.09 ############################ 系統(tǒng)...
    NamasAmitabha閱讀 1,465評論 0 0
  • Linux一切皆文件,因此對文本就會頻繁操作,增刪改查,也就有對文本處理的各種工具,下面介紹常用工具,以及各工具常...
    靜默閱讀 1,014評論 0 0
  • 本文筆記源自這里——[實驗樓]歡迎大家在下面交流其中有問題的地方喜歡請點收藏,每日更新(全部已親自實踐). 一. ...
    東皇Amrzs閱讀 4,313評論 7 54
  • 1.文件操作 echo "演示與文件和文件夾創(chuàng)建處理等相關(guān)命令" echo "查看文件目錄" echo "命令:l...
    sixmonk閱讀 387評論 0 1
  • 201705231、顯示/var目錄下所有以l開頭,以一個小寫字母結(jié)尾,且中間出現(xiàn)至少一位數(shù)字的文件或目錄ls 1...
    JevonWei閱讀 844評論 0 1

友情鏈接更多精彩內(nèi)容