Look is like a restricted grep


The look command is for looking up if a word exists in /usr/share/dict/words file, at least for most users. But, as the man page defines:

look — display lines beginning with a given string

which means that, for example, this command:

look what file

is equivalent to this command (with the exception that look ignores all whitespace characters at start):

grep ‘^what’ file

With this in mind, we can search easily for comment lines in all javascript files:

look ‘//’ *.js

or in .bashrc

look ‘#’ ~/.bashrc

For more, there is always grep, of course.

Visit The Light of the LAMP blog for more…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.