views:

120

answers:

2

I have hundreds of files in one folder named like this:

index.html?tab=This is - the file name

I would like to remove "index.html?tab=" part and add extension ".txt" to all files. How can I do this using Unix command line tools (I'm using MacOSX 10.6.2)?

+5  A: 

In bash,

for i in index.html\?tab\=*; do mv "$i" "${i:15}.txt"; done
KennyTM
Thanks, that was great!
jraja
+1  A: 
for file in index.html\?*
do
   mv "$file" "${file#*=}".txt
done
ghostdog74