Today i am trying to learn how to use sed. I set up a testing folder with the following files:
My goal is to create a script (test.sh) which renames all the files to their original name without AA. I want to end up with this:
sed seemed to be the perfect tool so i went ahead and created a script which i think should clear the job.
for i in $( ls ); do
NewName='sed' 's/AA//g' '$i'
mv '$i' $NewName
The output however is a lot of times this:
./test.sh: line 3: s/AA//g: No such file or directory
mv: missing destination file operand after `$i'
From that 2nd line i can tell that $NewName is just empty. I also read something about sed needing the -e option for scripting purposes but i just don't understand it.