egrep -w --color --exclude-dir='.svn' '[Bb]usiness [Uu]nits?|BUs?' WEB-INF/jsp/*
Everywhere the expression Business Unit, business unit, or BU appears in the JSP pages is now listed on my screen in color.
How does it work?
- Run grep (the GNU "find" utility) using Extended (that's where the E comes from) regular expressions.
- I was looking up the word boundary expression in the man page for grep and found that the -w switch forces the match to occur within word boundaries.
- Show the file names and matches in a different color (red) from the other text.
- Prevents grep from looking in subversion (source control) directories
- '[Bb]usiness [Uu]nits?|BUs?'
- Match "business unit" with or without initial caps and with or without an "s" at the end, or match "BU". These matches have to occur on word-boundaries (because of the -w above) so that ABUSE does not match.
- Run the match against all the files in the WEB-INF/jsp directory.
I pay about $150/year for an individual license for InteliJ IDEA because of it's refactoring, but it still can't do this. You can pry bash from my cold, dead hands.