NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: stupid question on vi



On Mon, 24 Feb 2025, beaker wrote:
The OP should be able to use named buffers for this task.

Steps:
1) create lines with the commands you want to run:
 /\x93        # vi cmd: find/search forward in file for "\x93"
 :%s/\x93//g  # ex cmd: globally replace all instances of "\x93" w/ ""

2) move to each line and yank into a separate named buffer:
 "fyy  # => sticks '/\x93' into buffer 'f'
 "gyy  # => sticks ':%s/\x93//' into buffer 'g' (global replace)

3) execute buffers as needed:
 @f    # => runs buffer 'f' ; use '/' and/or 'N' to repeat, 'x' to delete
 @g    # => runs buffer 'g' ; one-shot global substitution

I'm sorry but this is nonsense.  You are searching and replacing
the string "x93".

The OP literally said he wanted to do a search & replace; that's what
the 'g' named buffer example does.

Sorry if you are confused.

_I_ am confused...

Oh my...

adr


Home | Main Index | Thread Index | Old Index