0

I need to be able to write a range of lines from a file to another file, I've found the :<start>,<end>w <new file> solution but what I need is to be able to search for a string and write a a few lines to another file starting at the "found" location. Using .,. works to get one line but what if I want, say, 10 lines? Adding to the complexity is that I want to do this in a script. How do I do that (can I turn on Visual Mode in a script and then move the cursor)?

1 Answers1

0

A little more research searching for vi address range surfaced the answer:

Although .,.+10 is supposed to work it didn't but the alternate form .,.10 did (from https://vim.fandom.com/wiki/Ranges to give credit where credit is due).