This is not a valid command, but you get the idea: "cp *1.dbf *2.dbf"
I need to change the 1 to 2 on many file names.
Using csh. Any ideas?
MM
Must you use csh? This is easy with bash, for example:
# for file in *1.dbf; do cp ${file} `echo "${file}" | sed 's/1\.dbf/2\.dbf/'`; done
I don't use csh (or at least haven't for a long time) but a similar for loop using csh syntax will do the job.
Cheers,
ZB
Recent versions of bash allow for parameter pattern substitution; maybe other shells do as well:
for i in *1.dbf; do echo $i "--->" ${i/1./2.}; done
That works! No problem to use bash. Thanks for the help.
MM