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.
The command:
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:
symlink_13243
symlink_39184
symlink_83204
each row is a unique symlink name.
xargs
when an argument list is too long. What's wrong with the first command?readlink: missing operand
andcp: missing operand
file.1234.fasta