Latest web development tutorials

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命令大全