Question : shell scripting help

I have to write a script that will take the two files below and if the STL file comes in as with a uppercase extension, I have to rename the corresponding ACK file to also be in uppercase letters.  So in the instance below, I have to rename W555_ACK_0617091234.xml to W555_ACK_0617091234.XML.

W555_STL_0617091234.XML
W555_ACK_0617091234.xml

Any ideas on how to script this?  I have to do this on many files in one folder.

Answer : shell scripting help

Actually I don't still understand you. If you want  extensions to be matched, in your example:
W222_STL_06170901.xml
W222_ACK_06170901.xml
extensions are equal.
If you want extensions to be in uppercase... You did'n mention that before.  It is easier:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
for i in `ls *ACK*.xml *ACK*.XML 2>/dev/null`; do
  start=${i%%ACK*}
  end=${i#*ACK}
  ext=${end##*.}
  end=${end%.*}
 
  if ls "$start"ACK"$end".xml >/dev/null 2>/dev/null; then
    mv "$start"ACK"$end".xml "$start"ACK"$end".XML
  fi
  if ls "$start"STL"$end".xml >/dev/null 2>/dev/null; then
    mv "$start"STL"$end".xml "$start"STL"$end".XML
  fi
 
done
Open in New Window Select All
Random Solutions  
 
programming4us programming4us