Linux look命令詳解 Linux look命令怎麼用

來源:互聯網
上載者:User

look指令用於英文單字的查詢。您僅需給予它欲查詢的字首字串,它會顯示所有開頭字串符合該條件的單字。

文法

look [-adf][-t<字尾字串>][字首字串][字典檔案]

參數說明:

  • -a 使用另一個字典檔案web2,該檔案也位於/usr/dict目錄下。
  • -d 只對比英文字母和數字,其餘一慨忽略不予比對。
  • -f 忽略字元大小寫差別。
  • -t<字尾字串> 設定字尾字串。

執行個體

為了尋找在testfile檔案中以字母L開頭的所有的行,可以輸入如下命令:

look L testfile

原檔案testfile中的內容如下:

$ cat testfile #查看testfile 檔案內容

HELLO LINUX!

Linux is a free unix-type opterating system.

This is a linux testfile!

Linux test

在testfile檔案中使用look命令尋找以"L"開頭的單詞,結果如下:

$ look L testfile                                                   #尋找以“L”開頭的單詞

Linux is a free unix-type opterating system. #第二行以“L”開頭,列出全句

Linux test                                                             #第四行以“L”開頭,列出全句

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.