linux查找字典单词是什么-look命令使用与实例

linux查找字典单词是什么-look命令使用与实例

linux look命令

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”开头,整行展示 

© 版权声明
THE END
喜欢就支持一下吧
点赞10 分享