-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wed, 1 Oct 2003, Warwick & Ian wrote:
> I maybe being thick and / or lazy but what is the easiest command line
> equivalent to DOS:
>
> REN *.txt *.old
mv won't allow this because wildcard expansion (called globbing in
*nix) is done by the shell, not by the tool itself.
However, many Linux systems have a little tool which comes with perl
called 'rename'. rename accepts any perl expression which modifies $_ to
apply to each filename it gets, so thus you would do:
rename 's/\.txt$/\.bak/' *.txt
You can also do much more powerfull things, like renaming such that case
is changed to all lower-case, and many other useful things. See rename(1).
- --
David Zanetti | (__)
#include <geek/unix.h> | ( oo Mooooooo
http://hairy.geek.nz/ | /(_O ./
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Made with pgp4pine 1.75-6
iD8DBQE/ei8BT21+qRy4P+QRAq7xAJ0b054/sZIUu/5GlJuZa77+bqD/GACdFE9X
xrwwUyBKOWSiDMVyFqHp9PI=
=xn4D
-----END PGP SIGNATURE-----