-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Brett Parker <iDunno@sommitrealweird.co.uk> wrote:
Chris Glover <chris@glovercc.plus.com> wrote:
Hi,
Here's one for you...
If I have a range of files named dcp_1100.jpg - dcp_1189.jpg and I only want to copy 1156-1183, how do I do it.
cp dcp_11[56-83].jpg <dest> does not work, but cp dcp_115[6-9].jpg <dest> does.
OK, how about this...
cp dcp_11{5[6-9],[67][0-9],8[0-3]}.jpg dest
Yeah, it's not pretty, but it should work. The alternative is something like... (in bash):
for number in $(seq 1156 1183); do cp dcp_11$number.jpg dest done
And then, just because we can, and we like using as few processes as possible... for number in $(seq 1156 1183); do echo dcp_$number.jpg done | xargs cp --target-directory=dest Right - I wonder if anyone has anything more clean than that ;) (NOTE TO DAVE: No, you can not do: cp dcp_`seq 1156 1183`.jpg dest And here's why... the arguments to cp will expand to: dcp_1156 1157 ... 1183.jpg ) Cheers, - -- Brett Parker web: http://www.sommitrealweird.co.uk/ email: iDunno@sommitrealweird.co.uk -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCmjjEEh8oWxevnjQRAjfrAJsGuaGpdxcPP+PxWSiX6RneihwYIwCfdq/t WZAWEc8hxbRMR01aApTNPzI= =5lHT -----END PGP SIGNATURE-----