Loading ...
Sorry, an error occurred while loading the content.

Re: [Q] How can I find numbers from given interval

Expand Messages
  • BStrohhaecker@Hueller-Hille.com
    Von: Derek Wyatt [mailto:wyatt@syndesis.com] Gesendet: Freitag, 29. November 2002 15:44 ... solution. ... [...] I ve no idea how to do this with pure VIM. But
    Message 1 of 4 , Dec 2, 2002
    • 0 Attachment
      Von: Derek Wyatt [mailto:wyatt@...]
      Gesendet: Freitag, 29. November 2002 15:44

      > > Well, I have to admit, it was a bad examle. I need more generic
      solution.
      > > What about searching numbers from 1 564 033 to 1 598 730?
      >
      > That's a bit different :)
      >
      > And it's something i don't have the answer to (i've cc'ed the vim list in
      > case someone else knows).
      [...]

      I've no idea how to do this with pure VIM. But with a small
      (g)awk-script you can mark all numbers in your range with e.g.
      underscores and then search for '_\d\+_'.

      Try ':%!gawk -v FIRST_NUM=xxx -v LAST_NUM=yyy -f range.awk' with
      range.awk:

      { for ( i = 1; i <= NF; i++) {
      if ($i >= FIRST_NUM && $i <= LAST_NUM ) {
      $i = "_" $i "_";
      }
      }
      print $0;
      }

      Only a workaround, but works fine for me.

      Bernd
    Your message has been successfully submitted and would be delivered to recipients shortly.