Hi,
I have made 50 copies of a file. I want to change the "10" to "11","12"...."50" in the contents of file. File format is 10.txt, 11.txt .... 50.txt. So 11.txt, should replace the 10 with 11 in the file, 12.txt replace 10 with 12.. 50.txt replace 10 with 50.
I am trying to use sed. The command I have written just as a test to replace the number 10 with another number:
Code:
counter=11 ; for i in *.txt ; do sed -i "s/10/$counter/g" $i ; counter=$((counter+1)) ; done
It is replacing the whole line with blank, where it finds "10".
Thanks.