• look命令


    look命令

    look命令用于查询单词,仅需指定欲查询的字首字符串,它会显示所有开头字符串符合该条件的单词。

    语法

    look [-bdf] [-t char] string [file ...]
    

    参数

    • -a, --alternative: 使用备用字典文件。
    • -d, --alphanum: 使用普通字典字符集和顺序,即只比较空格和字母数字字符。如果未指定文件,则默认情况下此选项处于启用状态。
    • -f, --ignore-case: 忽略字母字符的大小写,如果未指定文件,则默认情况下此选项处于启用状态。
    • -t, --terminate character: 指定一个字符串终止字符,即仅比较字符串中直到第一个出现的字符,包括第一个出现的字符。
    • -V, --version: 输出版本信息。
    • -h, --help: 输出帮助信息。

    示例

    使用look查找以ab开头的单词。

    look ab
    # Abbas
    # Abbas's
    # Abbasid
    # Abbasid's
    # Abbott
    # Abbott's
    # Abby
    # ...
    

    在文件中查找以L开头的单词并列出全句。

    # file.txt
    HELLO LINUX!  
    Linux is a free unix-type opterating system.  
    This is a linux testfile!  
    
    look L file.txt
    Linux is a free unix-type opterating system.
    

    在上述示例中使用-t指定字符串终止字符,即仅比较字符串中第一次出现之前(包括第一次出现)的字符。

    look -t E HEO file.txt
    # HELLO LINUX!
    

    每日一题

    https://github.com/WindrunnerMax/EveryDay
    

    参考

    https://www.runoob.com/linux/linux-comm-look.html
    https://www.tutorialspoint.com/unix_commands/look.htm
    https://www.geeksforgeeks.org/look-command-in-linux-with-examples/
    
  • 相关阅读:
    bzoj4195 [Noi2015]程序自动分析
    bzoj4236 JOIOJI hash 模拟
    bzoj1012 [JSOI2008]最大数maxnumber
    day 4 名片管理系统 -函数版
    day 3 局部变量 全局变量
    day 2 函数的嵌套
    day1 函数 (独立功能代码块)
    day 14 元组
    day 13 字典dict 操作
    day 12 列表字典 补充
  • 原文地址:https://www.cnblogs.com/WindrunnerMax/p/14215659.html
Copyright © 2020-2023  润新知