[ale] sed and massively editing files.

Michael B. Trausch fd0man at gmail.com
Mon Nov 13 09:27:40 EST 2006


I am pretty sure that sed is the tool for what I want to do, but I can't
be sure.  I have it doing everything else that I need.  The lines that I
have are from a ZIP code database in SQL, but I need to make some
formatting fixups to the entire thing (42,320 lines).

Each line is like this:

INSERT INTO zip_summary (zip, city, state, county, area_codes,
city_type, latitude, longitude, time_zone, county_fips, observes_dst)
VALUES ('10452', 'Bronx', 'NY', 'Bronx', '{'347', '646', '718'}', 'P',
40.838324, -73.921892, '-0500', '005', TRUE);

Now, what I need to do is convert the ' characters to be " characters,
but only inside of {...} (where the area code list is).  I can't seem to
figure out how to do that, though, because if I use a s/.../...
expression, it would replace the entire thing, which isn't what I want.
Is there a regex that will say "Match an apostrophe if between squiggly
brackets" so that I can replace each occurrence with a quotation mark?

    -- Mike

--
Michael B. Trausch
                    fd0man at gmail.com
Phone: (404) 592-5746
   Jabber IM: fd0man at livejournal.com

Demand Freedom!  Use open and free protocols, standards, and software!
-------------- next part --------------
An HTML attachment was scrubbed...




More information about the Ale mailing list