I’m looking for a command in VI/VIM to search for particular text in the file and grab the whole line and output in either on the screen or separate file. e.g.
This is some line with this _word_ and some other text.
This is some line with this some other text and some other text.
so this would output only the first line..
The line will be output to the screen and to
output.txt. See:h :redir.EDIT: I agree with others who suggest using plain old *nix
grepif you can. Situations where you might not be able to usegrep:grepmight not exist on the system you’re using.redircan be useful in these situations.