can someone help me spot the problem here ?
#!/bin/sh
find . -name '*ABC*' > replace_temp.file
num_of_lines=`cat replace_temp.file | wc -l`
i=0
while $i<$num_of_lines
do
tc=`expr $i + 1`
line=`tail -$tc replace_temp.file |head -1`
line1=$line
sed -e 's/\(.*\)ABC/\1DEF/' $line
#mv -f $line1 $line
done
#rm -f replace_temp.file
i get the error replace.sh: line 6: 20: No such file or directory
purpose of this script: search and replace all files directories containing ABC in their name to DEF
it goes through the lines of find results file from bottom to top so there wont be any problems with dir dependencies (eg changing name of one dir will mess up changing the name of it’s sub dir)
thanks
should be something like
or if you insist