常用的Linux命令列文本處理工具總結

來源:互聯網
上載者:User

常用的Linux命令列文本處理工具總結 關鍵字搜尋:  grep  關鍵字  指定檔案     -i   搜尋時忽略大小寫     -n  顯示結果所在行     -v  顯示不包含關鍵字的行 基於列的文本處理:   cut -d: -f1 /etc/passwd   /*將passwd檔案按照:分隔開,取出裡面的第一列*/     -d  指定分割字元     -f  指定顯示列     -c  基於字元順序進行列分割 文本統計:  wc liangwode  /*統計liangwode檔案*/     -l   只統計行數     -w  只統計單詞書     -c   只統計位元組數     -m  只統計字元數  文本排序:  sort liangwode  /*對liangwode檔案按字母順序排序,該命令只適用於字母、數字排序,不適用於中文排序*/     -r   倒序排序     -n   基於數字進行排序     -f   忽略大小寫     -u   重複資料刪除行 文本比較:   diff liangwode-1 liangwode-2     -i   忽略大小寫     -b  忽略空格數變化     -u  統一顯示資訊(一般用於產生patch檔案) 文本轉換:   tr -d "liangwode" < liangwode     刪除指定關鍵字    tr 'a-z' 'A-Z' < liangwode    轉換大小寫 搜尋替換:  sed 's/linux/unix/g' linuxtest   將所有linux關鍵字替換為unix 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.