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

15217Re: Regex headache :)

Expand Messages
  • Jean-Raymond.Chauviere
    Dec 5, 2000
      Gregoire Welraeds wrote:
      > Hello vimers,
      > I have a file that is divided in 3 column. For selection purposes, the
      > only one that matters is the first one. Here is a small entry example:
      > 2dehands 1D IN NS ns.vuurwerk.nl.
      > 2design4u 1D IN NS auth00.ns.be.uu.net.
      > 2ez 1D IN NS ns.belbone
      > 2ez 1D IN NS ns2.belbone
      > 2frame 1D IN NS ns0.be.easynet.net.
      > 2its 1D IN NS ns1.tbs
      > 2its 1D IN NS ns2.skynet
      > 2its 1D IN NS ns2.tbs
      > 2its 1D IN NS ns3.skynet
      > 2mb 1D IN NS ns1.skynet
      > Now I could easily do a small awk script that delete a row if the name in
      > the first column is the same than the name in the above row (same column).
      > example:
      > 2its 1D IN NS ns1.tbs
      > 2its 1D IN NS ns2.skynet # <== delete this one
      > I was wondering if there is some magical vim regular expression capable of
      > doing the same job. Not that I need to do it in vim. Generaly, I think
      > that we should use the right tool for a job. Vim is an editor, awk a
      > pattern processing language.

      Not the answer to your question, ( I suppose pepe's one is good)
      but anyway you don't need awk
      sort -u +0 -1
      can do the job, eventually redirected to the vim buffer :-)

      Nur der Kleingeist hält Ordnung, das Genie beherrscht das Chaos.
      Seuls les petits esprits aiment l'ordre, le génie maitrîse le chaos.
    • Show all 3 messages in this topic