I am looking for an option in VI editor to display only the lines that match the particular string. After listing the lines, I would like to edit the word and that should reflect in the original file.
Eg:This is how my file is:
AAA1 X Y Z AAA3 Z Y AB AAA5 AAA8
I wish to change the sequence of AAA..like this
AAA1 X Y Z AAA2 Z Y AB AAA3 AAA4
I wish them to be in sequence. So, if I search and separate the lines on which AAA is there, I can edit that particular list.
vim /AAAA/g % | copen it opens all the lines which match the pattern AAAA. But when I edit them it is not being reflected in the original file.