|
Let me introduce a simple UNIX/Linux command which is very useful but not that popular. The name of the command is 'look'. As the name suggests, this command displays lines beginning with a given string.
Usage:
look string <file>
The look utility displays any lines in 'file' which contain 'string' as a prefix. This can be a simple alternative of using
$ grep "^string" <file>
If file is not specified while using the look command, the file /usr/share/dict/words will be used, only alphanumeric characters are compared and by default the case of alphabetic characters is ignored.
This utility can be very useful to look up the dictionary words from 'usr/share/dict/words'
e.g.
$ look Das
Dasheen
Dashers
Dashier
Dashiki
Dashing
Dashpot
Dassies
Dastard
Dasyure
In order to ignore the case of alphabetic characters you can use its -f option. (similar to grep -i)
Exit Status:
The exit status of the look utility will be 0 if one or more lines found and displayed.
The exit status of the look utility will be 1 if no lines found
The exit status will be >1 if there is an error.
That's a beautiful post. I can't wait to utilize the resources you've shared with us. Do share more such informative posts.
ReplyDeleteUnix Training in Chennai
Unix Shell Scripting Training in Chennai
JavaScript Training in Chennai
JavaScript Course in Chennai
C C++ Training in Chennai
C Training in Chennai
Unix Training in Tambaram
Unix Training in Adyar