cat list.txt | while read line;do mv "$line" ~/destination/;donexargs --arg-file=file -d '\t\r\n' mv -t dest xargsTakes a bunch of text and uses it as parameters to a specified program.
--arg-fileIf you don't say otherwise xargs uses the input from stdin, but it can also read from a file. We could have piped the output of cat instead, like everyone else above is doing.
-d '\t\r\n'Sets the delimiter to a tab. Each tab-separated item will be its own argument. that's the \t. the \r and \n are just in case there's newlines in there too.
mv -t destWhat to run on all those arguments. mv moves a file from one place to another. Normal use of mv is "mv src dest" but since all the xargs args go at the end, we are using the funny -t argument which tells mv which argument represents the target location (So they can be in whatever order).
--arg-file=file is not as clear as it could be. Pretend I wrote --arg-file=your_file_name_that_is_tab_delimited cat ~/Desktop/test.txt | while read line;do cp "$line" ~/Desktop/New/;done
xargs rather then the GNU version, and the options you're using aren't available. The command should becat ~/Desktop/test.txt | xargs -J % cp % ~/Desktop/New/
cp file ~/Desktop/New does the same thing as cp file ~/Desktop/New/. Anyway, this really is what xargs is for.cat ~/Desktop/test.txt | tr '\n' '\0' | xargs -0 -J % cp % ~/Desktop/New/
pbpaste command to feed the clipboard right to xargs:pbpaste | tr '\n' '\0' | xargs -0 echoYou are not logged in, either login or create an account to post comments
cat list.txt | while read file;do mv $line prefix_$line;doneor use imagemagick to resize from the command line:
mkdir small; cat list.txt | while read file;do convert -resize 1024x800 $i small/$i;doneOf course, some of this depends on what operating system you have, and exactly what tasks you're trying to accomplish. Can you give more details?
posted by chrisamiller at 8:20 PM on June 25