[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: VIM command to convert comma delimited text to latex table



On Wed, Feb 20, 2002 at 08:45:22AM -0800, Abner Gershon wrote:
> Can someone tell me search and replace commands I can
> use to convert comma delimited text in form:
> "field 1","field 2","field 3"
> to text file to be used in tabular latex file of form:
> field 1 & field 2 & field 3

Well, it all depends.  But iff each field is guaranteed to NOT have a
quote in it then the following should work:

   %s/"\([^"]\+\)","\([^"]\+\)","\([^"]\+\)"/\1 \& \2 \& \3/

when the fields do contain quotes you're out of luck and I don't know
how it will work on fields that have newlines in them.

-- 
groetjes, carel



Reply to: