There are lots of posts about how to search and replace a single column of a file, using \%Nc
syntax. I want extend this syntax to replace multiple columns in all lines that meet some criterion. For example,
PWITHDRAWAL BY EFTPOS 0240331 BWS
PEFTPOS DEBIT 0000409 GROUNDS
PEFTPOS DEBIT 0074959 ASQ INTE
PWITHDRAWAL BY EFTPOS 0510811 COLES
PWITHDRAWAL BY EFTPOS 0043699 XIAN
I need to modify columns 23-29 (the columns with numbers) on each line containing WITHDRAWAL BY EFTPOS
. Obviously there are lots of ad hoc ways to do this. For example,
g/PWITHDRAWAL BY EFT/s/\%23c/X
will change column 23 in the three selected lines to X
. I could repeat the command for each column that needs changing, but there's presumably something like g/BY EFT/s/\%23c-\%29c/X/
that would do it in a single command.
Could anybody advise please?