Hero search
Have you ever hero searched? Let's have a look at some grep
options.
-E
makesgrep
interpret the search pattern as an extended regular expression (equivalent to runningegrep
, but in this case, going for the option instead makes the acronym prettier);-R
makes it go through directories recursively;-h
suppresses the filename prefix in the output when searching multiple files;-o
makes it output only the matching substring, not the whole line that contained it.
Whack'em together, and you get -ERho
. Or, well, -hoRE
. No, wait. -hERo
! I dub thee "hero search" (mmm, mnemonics)!
Case in point: quick and dirty statistics of character entities in a directory of 500 sgml files:
$ grep -hERo '&[^;]+;' /path/to/files | sort | uniq -c | sort -nr
64 č
30 ř
24 ě
...