I would like to copy many files. I have their location as a set of symbolic links whose names are stored as lines in a txt file. So I am using cp and need to combine the readlink and cat/pipe functions. I haven't seen other questions deal with this combination.
cp $(readlink < /path/list.txt) -t /path/targetdir
A simpler example works where the symlink names are used explicitly in the argument of the readlink (but I have too many file names to do this manually), e.g.:
cp $(readlink symlink1 symlink2) -t /path/targetdir
The issue is in how I am combining the 'readlink' and the pipe, but I can't figure out what.
EDIT: here's an example of what's in the first lines of the list.txt file:
each row is a unique symlink name.
xargswhen an argument list is too long. What's wrong with the first command?
readlink: missing operandand
cp: missing operand