On Jan 08, 2016, at 20:16, Jaimie Lancaster <[email protected]> wrote:
> I recently received a list of contacts in a csv format. (About 1400 pages) 
> and I'm trying to get them into Filemaker pro.
______________________________________________________________________

Hey Jaimie,

Your data-sample is far too small to be certain this will succeed, but it looks 
like a multi-pass find/replace will do the trick.

-------------------------------------------------------------------------------------------
tell application "BBEdit"
  tell front text window's text
    
    # Separate state and zip with a commma.
    replace "(?-i)(\\b[A-Z]{2})\\b[[:blank:]]+(\\d{5})" using "\\1,\\2" options 
{search mode:grep, case sensitive:false, starting at top:true}
    
    # Remove trailing return character in address block.
    replace "\\r\"" using "\"" options {search mode:grep, case sensitive:false, 
starting at top:true}
    
    # Remove trailing return character from Street Address line and add comma.
    replace "(,\"[^\"\\r]+)\\r" using "\\1," options {search mode:grep, case 
sensitive:false, starting at top:true}
    
    # Remove all double-quote characters (").
    replace "\"" using "" options {search mode:grep, case sensitive:false, 
starting at top:true}
    
  end tell
end tell
-------------------------------------------------------------------------------------------

Original data-sample:

253,Joe's Pool Hall FWB ,"999 Veterans Memorial Dr
Anytown, AL 39044-1550
",06/19/2008,01/01/1991,001107,$ 84.45,$ 84.45,

Massaged Data:

253,Joe's Pool Hall FWB ,999 Veterans Memorial Dr,Anytown, 
AL,39044-1550,06/19/2008,01/01/1991,001107,$ 84.45,$ 84.45,

This may require tweaking depending upon what you're doing, but it's close.

If you don't know how to save an AppleScript and use it with BBEdit contact me 
off-list.

With 1400 pages to process it will probably take a few seconds to finish.

Alway test with TEST DATA and NOT with original data.

--
Best Regards,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].

Reply via email to