How can I replace strings in lets say 'last 10 lines' of multiple files?
I have about 100 files with the same extension '.txt' and I would like to replace string 'GLN' to 'LOO' in the last 10 lines of each file. How do I do this? I know how to do it for one file but not for several files.When I use this command ;
for i in `head -3 *.txt | awk '{print $4}'` do sed -i 's/GLN/LOO/g' *.txt done
It replaces GLN everywhere it appears in the files and not just the last 10 lines. Please, what am I doing wrong?