On 3/19/09 5:12 PM, "Mark J. Reed" <[log in to unmask]> wrote: > I would have used > > do shell script "sed -ne 's/^\\(..\\)" & zip & ".*$/\\1/p' zcta5.txt" > > but the principle is the same. You could also script TextEdit or > BBEdit... The variations I tried with pure AppleScript were > excruciatingly slow, but I might just be doing it wrong. I believe that Ed uses Excel. Ed, you could import a tab or comma-delimited text file, if that's what it is, into excel 9you can even script that, but you could just do it once in he UI and save the file as an .xls, and then script Excel to search for any zip code in the appropriate column and get the state code from its column in the same row. That would be fast, and scripting Excel's formula to do the same lookup would be even faster - instantaneous. Like Mark, I would counsel against trying to do a "pure" AppleScript parsing of the file, not using an application to do the heavy lifting: it will take forever. -- Paul Berkowitz