shell - One command to find a list of file names within files in another folder -
i'm quite new unix commands , might intuitive of you, please forgive ignorance.
what want find .txt files in folder has other sub-folders files inside. using found list, should file name , extension (no full path), need search .xml files within folder (also have sub-folders , files , parent of first searched folder) occurrences of file names found in first search.
hope clear enough!
i tried , didn't work (i know, it's absolutely beginner's try):
find . -name "*.txt" -printf "%f\n" -exec find .. -name "*.xml" | xargs grep {} \;
maybe somethiing (untested):
find . -name "*.txt" -printf "%f\n" > /tmp/a find . -name "*.xml" -exec grep -hff /tmp/a {} \;
maybe add -w
word-delimited searching.
another try @ process substitution:
find . -name "*.xml" -exec grep -hff <(find . -name "*.txt" -printf "%f\n") {} \;
Comments
Post a Comment