Find File List

From EggeWiki
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.