From a543f5bdd4f2dbccc52484e0f85b07fc969a08d7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 31 Dec 2013 06:20:51 +0000 Subject: [PATCH] [Tranalsted] look--Linux Command To Verify Spellings And Display Lines Beginning With A String --- ...d Display Lines Beginning With A String.md | 59 +++++++++---------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/sources/look--Linux Command To Verify Spellings And Display Lines Beginning With A String.md b/sources/look--Linux Command To Verify Spellings And Display Lines Beginning With A String.md index d7b00e67d5..0f4c585f96 100644 --- a/sources/look--Linux Command To Verify Spellings And Display Lines Beginning With A String.md +++ b/sources/look--Linux Command To Verify Spellings And Display Lines Beginning With A String.md @@ -1,29 +1,26 @@ -Tranalating-------------------geekpi - - -look : Linux Command To Verify Spellings And Display Lines Beginning With A String +look: Linux 下验证拼写并显示以某字符串开头的行的命令 ================================================================================ -Have you ever felt the need of a command line utility in Linux through which you can verify spellings? A utility that can display lines in file which contain a particular string as a prefix? Well, in this article we will discuss the **look** command in Linux that is capable of doing both these tasks. +你有没有感到需要一款Linux下的命令行工具,它可以验证你的拼写?一款可以显示包含特定前缀字符串的行?好的,本篇中,我们会讨论Linux下的 **look**命令,它满足了上面的这些要求。 -### look Command In Linux ### +### Linux下的look命令 ### -Here is a snapshot of the description of look command from its man page : +下面是来自look命令man页面描述的截图: ![](http://mylinuxbook.com/wp-content/uploads/2013/12/look-main.png) -### Testing Environment ### +### 测试环境 ### - **OS** – Ubuntu 13.04 - **Shell** – Bash 4.2.45 - **Application** – look 2.20.1-5.1ubuntu8 -#### A Brief Tutorial #### +#### 简要教程 #### -Now lets discuss this command through some practical examples. +现在让我们通过一些特定例子来讨论这个命令。 -Suppose you want to verify the spelling of the word rendezvous. You can do it easily using look command. +假设你要验证单词'rendezvous'的拼写。你可以轻松地用look命令做到。 -Here is an example : +这是个例子 : $ look rendez rendezvous @@ -32,51 +29,51 @@ Here is an example : rendezvouses rendezvousing -So as you can see, I just passed a few initial characters of the word as command line argument and the command produced all the related words. These words are fetched by the look command from the file **/usr/share/dict/words**. +如你所见,我只传入了单词的前面几个字符作为命令行参数,命令产生了所有的相关单词。这些单词通过look命令从文件 **/usr/share/dict/words**取回。 -Another scenario could be the one in which it is required to print all the lines beginning with a particular string. For example, if I want to display all the header files that are included in a c file, I’d use the look command in the following way : +另外一种情况是需要打印所有包含特定字符串的行。比如,如果我想要显示c文件中所有的头文件,那么我就用下面的方法: $ look "#include" efence_test.c #include #include -So you can see that it produced all the lines in file efence_test.c that begin with the string “#include” and hence I got to know the header files included in this source file. +如你所见,它生成了所有的在文件efence_test.c中以"#include"开始的行,因此我知道了原文件中包含的头文件。 -By default, all the matching that the look command does is case-sensitive. You can opt for non-case-sensitive matching by using the **-f option**. +默认上,所有look命令的匹配都是大小写敏感的。你可以使用非大小写敏感匹配的选项**-f**。 -Here are some other command line options that the look command provides : +下面是一些look命令提供了其他一些命令行选项: ![](http://mylinuxbook.com/wp-content/uploads/2013/12/look-options.png) -For more information on this command, read its [man page][1]. +想要获取这个命令的更多信息,阅读这个 [man 页][1]. -#### Download/Install/Configure #### +#### 下载/安装/配置 #### -Here are some of the important links related to the look command : +下面是关于look命令的一些终于链接: -- Home Page [*Let me know if you find home page of this utility*] -- Download Link +- 主页 [*如果你知道这个工具的主页的话让我知道一下*] +- 下载链接 -The look command comes as a part of **util-linux** package which is pre-installed in most of the Linux distributions. +look命令成了**util-linux**包的一部分,它在大多数Linux发行版中已经预安装了。 -#### Pros #### +#### 优点 #### -- Easily verify spellings from command line -- Comes pre-installed in most of the Linux distributions +- 非常容易地在命令行验证拼写。 +- 在大多数Linux发行版中已经预安装。 -#### Cons #### +#### 缺点 #### -- Depends on /usr/share/dict/words for spelling verification. +- 依赖于/usr/share/dict/words 来做拼写验证。 -#### Conclusion #### +#### 总结 #### -An excellent command line utility to verify spellings. Saves a lot of time if you want to display lines beginning with a particular string. Try it, you’ll definitely like it. +一款出色的用来验证拼写的命令行工具。节省了大量时间如果你想要显示以特定字符串为开头的行的话。试一下,你一定会喜欢上它的。 -------------------------------------------------------------------------------- via: http://mylinuxbook.com/look-verify-spellings-and-display-lines/ -译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) +译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出