directory name = /usr/tom/1997
files -
ABC_1997_ST1_BCD.SQL
BCD_1997_ST1_EFG_SAB.SQL
TTT_EBC_1997_ST1_A.SQL
sub directory - /usr/tom/1997/jan
a) I want to just rename the all files ending with '.SQL' and also its contents in the 1997 directory(excluding subdirectories eg '/usr/tom/1997/jan) like
ABC_1997_ST1_BCD.SQL to ABC_1997_ST2_BCD.SQL
(also change the any 1997_ST1 TO 1997_ST2 within the file as well)
BCD_1997_ST1_EFG_SAB.SQL to BCD_1997_ST2_EFG_SAB.SQL
(also change the any 1997_ST1 TO 1997_ST2 within the file as well)
TTT_EBC_1997_ST1_A.SQL to TTT_EBC_1997_ST2_A.SQL
(also change the any 1997_ST1 TO 1997_ST2 within the file as well)
i was able to change the file contents but not the filename.Also the folowing
script changes even the subdirectories which i do not want
list=`ls`
for i in $list
do
sed -n '/[sS][Tt]1/p' ${i}
done