RootsWeb.com Mailing Lists
Total: 2/2
    1. Re: Using AWK to manipulate GEDCOM files
    2. Ed Morton
    3. On 2/20/2013 2:25 AM, Steve Hayes wrote: > On Wed, 20 Feb 2013 08:41:54 +0100, Janis Papanagnou > <janis_papanagnou@hotmail.com> wrote: > >> On 20.02.2013 07:05, Steve Hayes wrote: >>> On Tue, 19 Feb 2013 14:06:25 +0100, Janis Papanagnou >>> <janis_papanagnou@hotmail.com> wrote: >>> >> [...] >>>> >>>> awk '$2 !~ /@.*@/ { sub(/Service/, "S.") } { print $0 }' >>> >>> I substituted "Ellwood1.ged" for "!~" and got this: >> >> What did you intend to do? > > See what happened when I ran it on a file. Post what you tried because what you say you did `substituted "Ellwood1.ged" for "!~"` sounds like you replaced the regexp inequality operator with the name of a file which doesn't make sense. if you wanted to run Janis's script on a file named Ellwood1.ged you'd do: awk '$2 !~ /@.*@/ { sub(/Service/, "S.") } { print $0 }' Ellwood1.ged if you're on UNIX. If you're on Windows, it's different so tell us which OS you're on. Ed. > > I'll play with it some more. > >

    02/19/2013 11:43:30
    1. Re: Using AWK to manipulate GEDCOM files
    2. Steve Hayes
    3. On Wed, 20 Feb 2013 06:43:30 -0600, Ed Morton <mortonspam@gmail.com> wrote: >On 2/20/2013 2:25 AM, Steve Hayes wrote: >> On Wed, 20 Feb 2013 08:41:54 +0100, Janis Papanagnou >> <janis_papanagnou@hotmail.com> wrote: >> >>> On 20.02.2013 07:05, Steve Hayes wrote: >>>> On Tue, 19 Feb 2013 14:06:25 +0100, Janis Papanagnou >>>> <janis_papanagnou@hotmail.com> wrote: >>>> >>> [...] >>>>> >>>>> awk '$2 !~ /@.*@/ { sub(/Service/, "S.") } { print $0 }' >>>> >>>> I substituted "Ellwood1.ged" for "!~" and got this: >>> >>> What did you intend to do? >> >> See what happened when I ran it on a file. > >Post what you tried because what you say you did `substituted "Ellwood1.ged" for >"!~"` sounds like you replaced the regexp inequality operator with the name of a >file which doesn't make sense. if you wanted to run Janis's script on a file >named Ellwood1.ged you'd do: > >awk '$2 !~ /@.*@/ { sub(/Service/, "S.") } { print $0 }' Ellwood1.ged > >if you're on UNIX. If you're on Windows, it's different so tell us which OS >you're on. I'm on Windows. Tried it as you suggested, and this was the result: H:\>awk '$2 !~ /@.*@/ { sub(/Service/, "S.") } { print $0 }' Ellwood1.ged DOSPRN Print Spooler. Version 1.77 (c) 1990-2004 by Gurtjak D., Ignatenko I., Goldberg A. Use extended memory: 200K Use conventional memory: 4K '$2 ^ awk: line 0: syntax error H:\>gawk '$2 !~ /@.*@/ { sub(/Service/, "S.") } { print $0 }' Ellwood1.ged gawk: '$2 gawk: ^ invalid char ''' in expression H:\>gawk $2 !~ /@.*@/ { sub(/Service/, "S.") } { print $0 } Ellwood1.ged gawk: cmd. line:1: fatal: cannot open file `!~' for reading (No such file or directory) H:\> I tried first with an older version of AWK, and later with a newer one (called gawk above). When it said it didn't like the "'" characters, I removed them and tried again. -- Steve Hayes from Tshwane, South Africa Blog: http://khanya.wordpress.com E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk

    02/20/2013 11:14:18