NetBSD-Users archive

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

Re: stupid question on vi



On Sun, 23 Feb 2025, beaker wrote:
I'm not seeing the Ctrl-X thing on NetBSD 9.3, though maybe that's
the poorly documented aspect..

It's there since (at least) 1997:
https://docs-archive.freebsd.org/44doc/usd/13.viref/paper.pdf

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

Nvi regular expressions doesn't support the (perl?) escaped sequences
\xNN that has been added to sed. This is the hole subject of the
thread.

RPV gave the answer the OP was looking for, let's not
confuse people who can encounter this thread.

adr


Home | Main Index | Thread Index | Old Index