Linux look命令

Linux 命令大全 Linux 命令大全

Linux look命令用於查詢單詞。

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”開頭,列出全句

Linux 命令大全 Linux 命令大全