Skip to content

Using the Linux look command to select lines from files

The look command on Linux can be handy for selecting particular lines from text files with sorted contents. Let’s look into how it can be used and where you might run into some problems.

Case sensitivity

If you type a command such as “look unix”, you should see this:

$ look unix
UNIX
Unix
unix

Notice that, because no file was specified in the command shown, look reverts to using the words file on the system (probably /usr/share/dict/words or whatever that points to). Also notice that it finds the three lines in the file even though the argument for the command has only lowercase characters. The command is case-insensitive when you don’t provide a file name and instead allow it to default to the words file.

To read this article in full, please click here

Source:: Network World – Data Center