I have a whole bunch of files with certain patterns
ABCD: Something 1 Anything 2 EFGH: Something 3 Anything 4 ABCD: Something 5 Anything 6 HIJK: Something 7 Anything 8
I want to retain the second line after ABCD and delete everything else in all these files. On a single file, this can be achieved using vim by the following commands
/ABCD\_[^a-zA-Z] (*searches the pattern*) qaq (*flush register*) :g//norm! "A3Y (*yank 3 lines including pattern into register A*) ggVG"ap (*delete everything else*)
Then I can perform some easy regex searches to delete the ABCDs and Somethings to be left with the correct Anythings.
argdo as suggested here for multiple files throws up errors "Not an editor command" at the second operation above. Same thing happens if I bypass the second, and go directly to the third and fourth. I am performing
argdo after each step.
Any recommendations staying within or going beyond vim?