in reply to RegEx match in files
This is unclear to me. You are saying that you want to modify some files, but your code (if it were to compile) would only try to modify the file names. What are you really trying to do?
If you just want to rename your files, you could also try a Perl one-liner like this one:
perl -e '$c=$_=shift; s/\d/yy/g; $d = lc ; rename $c, $d;' FOOBAR*.TXTOr, if you want to make sure you don't override an existing file (it might happen on some OS's, not quite sure):
perl -e '$c=$_=shift; s/\d/yy/g; $d = lc ; rename $c, $d unless -e $d;' FOOBAR*.TXT
|
|---|