1

I have based my script on the following quesstion Find and replace text within a file using commands

I have a lot of files named test_xxx_01.sql in which i need to replace a text testoriginal with testoriginal_xxx so I wrote the following command

for i in {220,630,1000}; do sed -i 's/testoriginal/testoriginal_\$\{i\}/g' test_${i}_01.sql; done

the expected output is that in the file test_221_01.sql, i should now have 'testoriginal_221'.

but instead i have testoriginal_${i}

how can i fix this command?

Anand
  • 111
  • 4

0 Answers0