Monday, November 7, 2011

Re: search and replace (not what was searched for)

On 11/7/2011 11:18 AM, Taylor Hedberg wrote:
> You're looking for the `:global` (a.k.a. `:g`) command.
>
> For your example:
>
> :g/^\[\d/s/$/]
>
> This says, "Tag lines matching the pattern /^\[\d/ (open bracket at the
> beginning of the line, followed by a decimal digit), and on each tagged
> line, replace the end of the line with a close bracket."
>
> In general, `:global` searches for lines matching a given pattern and
> then executes an ex command on each matching line. The command executed
> does not have to be related to the global search pattern.
>
> For more details, check out `:help :global`.
>
Great! That is exactly what I need. Gotta read up on global,

Totte


--
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

No comments: