I have a file called "file.txt" and it contains globs. Contents:
*.tex
*.pdf
*C*.png
I need to get these extensions from the file and then find the files containging these globs in the current directory (preferably using find, anything else is fine too).
I used
grep "" file.txt | xargs find . -name
but I get this error:
find: paths must precede expression: `*.pdf'
Using Ubuntu
The original code needs the
-n 1argument to be passed to xargs, to pass only one glob to each copy offind, as each glob expression needs to be preceded with a-name(and attached to any other-nameexpressions with-o, the "or" operator).More efficient is to run
findjust once, after constructing an expression that puts all your-nameoperators on a single command line, separated with-os.