Line 18 | 200 040 200 200 200 051 200 1C2 200 2E2 Line 18 | 200 040 200 040 200 052 200 1B9 200 2F4 Line 18 | 200 040 200 040 200 200 200 1C2 200 2DC Line 18 | 200 040 200 040 200 063 200 1D6 200 2D4

How do I deleted per line all the 'odd' 200?
So that it becomes like:

Line 18 | 040 200 051 1C2 2E2 Line 18 | 040 040 052 1B9 2F4 Line 18 | 040 040 200 1C2 2DC Line 18 | 040 040 063 1D6 2D4

use the 'g' flag of the substitute command:

  :%s/\<200\>/   /g


Notice that his output does have *some* 200s in it. I'm not sure what the input/output looks like exactly, as it's possible that MTA/MUAs between Eric and the VimML and my machine have bunged with matters. Getting the original text might help:

        bash> head -3 file.txt | xxd | vi -

should give you a binary dump of the first 3 lines of file.txt allowing us to better see where linebreaks and spaces/tabs fall.

It *sounds* like Eric is looking for something like this monsterous one-liner:

%s/\<\(\x\x\x\)\(\_s\+\x\x\x\)\>/\=((submatch(1)==200)?' ':submatch(1)).submatch(2)

(that's 3 spaces in those quotes, in case of further mailer problems, one for each character of "200")

which finds all the "odd" 200's in the block (as a ":hls" with searching on that initial pattern will show it finds)

However, it doesn't come out with the same results as Eric's expected results. Thus, we either have a problem of conveying the problem, or there's an error in the expected output.

-tim





Reply via email to