In principle find
does not accept data by the standard input, so the data sent by cat
to find
have no effect on its operation.
Try this expression:
xargs -I '{}' find . -name '{}' < archivos.txt | xargs -I '{}' cp '{}' /tmp/
Notice that it is not necessary to use cat
, just an input redirect. We use {}
as container of each line of archivos.txt
and for each result found by find
we repeat the process to make the copy.
Use the -I
modifier to set the substitution pattern:
-I replace-str
Replace occurrences of replace-str
in the initial-arguments with names read from standard input.
Also,
unquoted blanks do
not terminate input items; instead the separator is the newline character.
Implies -x and -L 1.
In Spanish:
-I chain-replacement
Replaces the occurrences of cadena-reemplazo
in the arguments with the names obtained from the standard input.
Also, blank spaces without escaping do not end the input elements; instead the separator is the new line character.
Imply -x and -L 1.
A reduced version in which I use =
as a container for each data line would be:
xargs -I '=' find . -name '=' -exec cp {} /tmp/ \; < archivos.txt