天天看點

Linux 文本處理指令

1. cat : concatnate

options :

    -n : number   顯示行号

    -E : end      顯示每行結尾的辨別符 (Linux 中每行結尾的辨別符為 $ ,而Windows 中為 $+ 回車 )

    -v : visible  可見的  顯示非列印字元

2. more :

3. less   : 

4 head : 從頭顯示

    -n 指定行數

5. tail : 檢視檔案尾部

    -f :   fllow  檢視檔案尾部,不退出等待後續追加至此檔案的新内容

6. cut : 對檔案内容進行修飾輸出

        -d : delimiter    指定分割符

        -f  : filed           指定字段

         -b : byte           按位元組分割

         -c : characters   按字元分割

7. sort : 預設根據ASCⅡ碼先後排序  按照字元從左到右

        options : 

                    -n :  number    按數值排序

                    -r  :  resort

                    -t  : trainsition  設定分割符

                    -k : key             指定以哪個字段為關鍵字進行排序    與 -t 連用

                    -u : unique         相同的行隻顯示一次(相臨且相同的行,為相同行)

                    -f  : fold (合攏,籠罩)   忽略大小寫

                    -c :  count         顯示重複行個數

                    -d :  double       隻顯示重複行

8. wc  : word count

        options :

                    -l  : line               隻顯示行數

                    -c : bytes count  隻顯示位元組數

                    -w : word            單詞數

                    -m :                     隻顯示字元數

                    -L  :                      最長一行包含多少字元

9. tr  : trainsition remove        轉換或删除字元

                    -d : delete

                ex :  tr ab    AB          AB 替換  ab    (替換時一一對應)

                        tr a-z  A-Z

繼續閱讀