I've got a directory with numbered files, e.g. 1_foo.txt 2_bar.asc 13_test.png, and want to move them into individual directories (e.g. 1, 2 and 13) using as simple a bash command as possible.
Creating the numbered directories was easy:
mkdir $(seq 1 15)
I've also come up with a command to copy the files into their respective directories:
seq 15 -1 1 | xargs -I@ mv @_* @
That doesn't work, though, as the * is interpreted as a normal character when used with xargs, giving me errors like "mv: File '15_*' not found.".
Is there any easy way to use * as a wildcard in a command called by xargs?