Wednesday, May 7, 2014

Re: Search in VI (VIM) for a string, then delete to end of line.

Would this solve your problem?

:%s/HERE.*$//gc



On May 7, 2014, at 11:07 AM, Nerdio <logistexsteve@gmail.com> wrote:

I have a requirement which I am sure I can do in vi (plenty of other solutions I am sure), and this is it.

I have a file that looks like this

1234 Some Text HERE rest of line
1235 Some Other Text HERE rest of line

What I want to do is delete text from, and including the word HERE to the end of the line, leaving me with this;

1234 Some Text
1235 Some Other Text

I have done search and replace things in vi, but am not sure how to do a search then run a command.

Any help, as always is greatly appreciated.

Thanks in anticipation

(This has been posted elsewhere, so sorry for duplication)

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: