RootsWeb.com Mailing Lists
Total: 3/3
    1. Re: Search and replace in one field
    2. Charlie Hoffpauir
    3. On Sat, 16 Feb 2013 16:51:50 GMT, Eagle@bellsouth.net (J. Hugh Sullivan) wrote: >On Sat, 16 Feb 2013 09:04:31 -0600, Charlie Hoffpauir ><invalid@invalid.com> wrote: > >>You sparked my interest. I still try to use GEDCOM Explorer (GEDX) >>occasionally, so I'd like to hear more about AWK. I might have heard >>of it, but it's too early in the morning for me to think clearly.... >>What does AWK stand for? > >After talking with my friend he suggests using GREP. Are you familiar >with GREP - Steve? > >Hugh I think grep would work on making the changes to the GEDCOMs, but as far as I know it's only used in Linux or Unix-like programs, which I've played with but decided at my age it's too late to try to become proficient in. Using word is the lazy way, you just figure out what Word editing steps you have to make, then record it to a macro. If it truns out that isolating the given name field in the GEDCOM is easy, then it might not even be worthwhile to record it to a macro.... just a couple of steps of search/replace. It would be super easy if you had used some other character to define the used name.... it gets difficult because the " mark is probably used in many places of text where you don't wnat the " replaced by another character.

    02/16/2013 04:19:26
    1. Re: Search and replace in one field
    2. J. Hugh Sullivan
    3. On Sat, 16 Feb 2013 11:19:26 -0600, Charlie Hoffpauir <invalid@invalid.com> wrote: >I think grep would work on making the changes to the GEDCOMs, but as >far as I know it's only used in Linux or Unix-like programs, which >I've played with but decided at my age it's too late to try to become >proficient in. Using word is the lazy way, you just figure out what >Word editing steps you have to make, then record it to a macro. If it >truns out that isolating the given name field in the GEDCOM is easy, >then it might not even be worthwhile to record it to a macro.... just >a couple of steps of search/replace. It would be super easy if you had >used some other character to define the used name.... it gets >difficult because the " mark is probably used in many places of text >where you don't wnat the " replaced by another character. I presumed from what I was told that it would be as simple as telling grep to look for the GED Sullivan Combo, find "X" or "*"and replace the quotes. It forms a new file but doesn't destroy the old. Of course everything is simple to that guy. I'm not sure why I would think anything is that simple. I don't recall using ""s for anything else. Hugh

    02/16/2013 12:25:44
    1. Re: Search and replace in one field
    2. Ian Goddard
    3. J. Hugh Sullivan wrote: > On Sat, 16 Feb 2013 11:19:26 -0600, Charlie Hoffpauir > <invalid@invalid.com> wrote: > >> I think grep would work on making the changes to the GEDCOMs, but as >> far as I know it's only used in Linux or Unix-like programs, which >> I've played with but decided at my age it's too late to try to become >> proficient in. Using word is the lazy way, you just figure out what >> Word editing steps you have to make, then record it to a macro. If it >> truns out that isolating the given name field in the GEDCOM is easy, >> then it might not even be worthwhile to record it to a macro.... just >> a couple of steps of search/replace. It would be super easy if you had >> used some other character to define the used name.... it gets >> difficult because the " mark is probably used in many places of text >> where you don't wnat the " replaced by another character. > > I presumed from what I was told that it would be as simple as telling > grep to look for the GED Sullivan Combo, find "X" or "*"and replace > the quotes. It forms a new file but doesn't destroy the old. Of course > everything is simple to that guy. > > I'm not sure why I would think anything is that simple. > > I don't recall using ""s for anything else. Simple sed script to remove ALL quotes: sed s/\"//g my.ged > new.ged Explanation: the s command is the substitute command. It searches each line for the first occurrence of that's between the first & second / and substitutes what's between the second & third so that sed s/this/that/ will replace the first this with that. Adding a g (global) after the command makes it replace all occurrences. However " is meaningful to the shell (the Unix equivalent of command.exe) but preceding a character with a backslash tells the shell to ignore it so where the line contains \" the shell removes the \ and passes the " to the command. So what sed sees as its first parameter is s/"//g which tells it to replace all occurrences of " with nothing. The second parameter is, of course the name of the file to be processed so it will read all the lines in the file, remove each occurrence of " and replace it with nothing. The > new.ged simply tells the shell to create a file called new.ged and direct sed's output into it. By contrast grep \" my.ged would simply return all the lines which included a " but wouldn't do any other processing on them. -- Ian The Hotmail address is my spam-bin. Real mail address is iang at austonley org uk

    02/17/2013 04:24:05