Find File List

From EggeWiki
Revision as of 21:35, 10 October 2007 by Egge (talk | contribs) (New page: == Create a list of files which contain a pattern == <geshi lang="bash"> $ SEARCH=SomePattern $ find . -name "*.java" | xargs grep $SEARCH | cut -d: -f1 | sort | uniq | tr '\n' ' ' ./src/...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Create a list of files which contain a pattern

<geshi lang="bash"> $ SEARCH=SomePattern $ find . -name "*.java" | xargs grep $SEARCH | cut -d: -f1 | sort | uniq | tr '\n' ' ' ./src/MyFile.java ./test/MyFileUnitTest.java </geshi>

These files can then be used as arguments for cvs diff, cvs commit, etc.. Initially I tried using sed to join the lines together, but then I remembered the handy tr command.