I have an error report where often the known errors are in the top few thousand lines, formatting issue rather than quantity unfortunately.
I want to run :g/pattern/
from the end of the file.
I know :g/pattern/m0
reverses the file which is mainly the same thing but if I don't put it back to how it was the line references are wrong when I query the error.
I tried $,1g/pattern/
but got Backwards range given, Ok to swap (y/n)?
.
Selecting n aborts the command.
Is this achievable?
**error lines
per physical error. When there is a defect impacting the report I often miss the trees for the forest. Reversing the search is just a way of filtering out most of the errors at the top of the file and ensuring I don't miss some.:g/pattern/m0
works but I was hoping to use a reverse range?pattern
, which will search backwards? Why are you using:g
? To search for those lines? Using/
and?
are the search operators, and the latter searches backwards... Are you using the pattern to look for the lines with the error? Perhaps some form of folding might help you, folding all lines that are not the ones you care about... But it's still hard to figure out exactly what you want. Can you give more specific examples? Perhaps a snippet of a file and the operation you're trying to accomplish there? Please edit the question.:g
to get a list of the error and just forgot ? did what I want