From: Nick H. <nic...@ho...> - 2011-06-08 18:34:29
|
Doug, You could try vi. It has a good regexp implementation. Try: :1,$s/^\([a-zA-Z]*,[a-zA-Z]*,\)/\1,,,/ or: :1,$s/[a-zA-Z]*,[a-zA-Z]*,/&,,,/ \1 is the contents the first grouping & is the contents of the match Nick. On 08/06/11 17:33, doug wrote: > I have a csv database to import into gramps and want to add > a lot of missing fields, e.g. along the lines of converting > COHN,Abraham,Ostrowo > COHN,Abraham,Posen > COHN,Abraham,Pinne > COHN,Abraham,Meseritz ...........etc. > > into > COHN,Abraham,,,,,,,,,,,,,,,,,Ostrowo > COHN,Abraham,,,,,,,,,,,,,,,,,Posen > COHN,Abraham,,,,,,,,,,,,,,,,,Pinne > COHN,Abraham,,,,,,,,,,,,,,,,,Meseritz > > No doubt the thing could be simply opened as a spreadsheet > and new columns inserted. > However I feel it ought to be possible to do this via regex, > but stumped as to how. > > I've been trying things like > search: "(?:[a-zA-Z]+)," to match "COHN,Abraham," and > replace: ",,,,,,,,,,,,," > which just gives ",,,,,,,,,,,,,,,,Ostrowo" instead > "COHN,Abraham,,,,,,,,,,,,,,,,,Ostrowo" > and other variations using lookahead or lookbehind, all > without success. > > > I can't see how to match a string without 'using it up' so > that it will still appear in the edited version. Whether > this is just me failing to understand lookahead and > lookbehind, or whether it's that the editors I'm using don't > implement regex fully, I don't know. > I'd be glad of any help and any recommendation for a good > regexp editor. > > Doug > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > Gramps-users mailing list > Gra...@li... > https://lists.sourceforge.net/lists/listinfo/gramps-users > > |