[NBLUG/talk] command line search/replace

Barry Stump barry.stump at gmail.com
Tue Nov 7 10:38:16 PST 2006


On 11/7/06, S. Saunders <sms at sonic.net> wrote:
>
> On Sat, November 4, 2006 07:50, Barry Stump wrote:
>
> > I found the hard part with grep is to make the process interactive for
> > each match, rather than each matching file.  Vim makes this easy with
> > the /c switch for the substitute command.
>
> <nod>
>
> Thing about scripting is, it's usually a quick-and-dirty method, go with
> what you know.  Sed (I believe) offers the same switch and is usually the
> preferred choice for scripting.
>
> Invoking vim each time is less-efficient, but in our bloatware days (where
> 64M isn't enough for most Linuxes -- remembering that the original IBM
> PC's used to have 64*K* of RAM!), this sort of "inefficiency" is less and
> less worth "fixing".
>
>
> - Steve S.


I can't find any reference to a flag for the sed s/ command that makes
it ask for confirmation.  Invoking vim like this definitely is slow
with many matches, but unless there is an alternative with sed or awk,
I'm stuck with vim.

-Barry



More information about the talk mailing list