Market

2010/09/12

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.