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

49774Re: comma-separated fields - conversion, 1 line to N

Expand Messages
  • gumnos (Tim Chase)
    Apr 30, 2004
      > A friend of mine asked me how to convert file with these fields:
      > country,code1,code2,...,codeN
      > into
      > country,code1
      > country,code2
      > ...
      > country,codeN
      > How to do it in vim ?

      It looks like a substitute along the lines of


      would do the trick where:

      COUNTRY is a regex that finds countries
      (eg. "[^,]*" may be sufficient)
      CODE is the same sort of thing, finding codes
      (again, "[^,]*" may suffice)
      ^M is entered with ctrl+V followed by ctrl+M
      (I think you can use <cr> or \n here
      instead, but I never remember which
      one works, so I use the ^V^M method)

    • Show all 8 messages in this topic