Find File List

From EggeWiki
Revision as of 22: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)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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.