Steven Cappiello Posted August 18, 2004 Posted August 18, 2004 Dear all, I have a text file that has a ton of names & addresses separated by one or sometimes two carriage returns. (There is also a carriage return at the end of each line) example: Tom Smith 12 Park Place New York, NY 10034 Bill Frankel PO Box 974 Mills Highway Minneapolis, MN 34387 Janet Parker UCLA West Wing Box 4343 Los Angeles, CA 94372 . . . Could someone recommend the easiest way to import this information into a simple Filemaker database ? I'd be happy with having each person having their own record, and getting the name into a "name" field and the rest of the address into an "address" field. It would be great if I could make an attempt to get the last line of the address to import into "city" , "state" and "postal code" fields as well. Many thanks in advance!! Steven
Charles Delfs Posted August 18, 2004 Posted August 18, 2004 since there is a double CR in between each entry you can do a bit of preimport work. But, another problem is that some entries have more lines. If you just want to import data and not worry too much about getting it into the right field eg addr1, addr2, addr3 and addr4 then this technique will work backup your file. In a word processor Replace all double CR's with a place holder not in the file eg a pipe '|' char. then replace all single CR's with comma's then replace all placeholder pipes with CR's this will put each entry on a seperat full line sererated by commas. when you import, match up your fields as best as possible. c.
Fenton Posted August 19, 2004 Posted August 19, 2004 This is a bit of a problem. I see you say you're a newbie. Well, I can think of two approaches, neither very easy, but doable. As Charles says, you're going to be using a text editor to do some work first, converting the double carriage returns as he says. You might want to use Tabs instead of commas as field separators; that's my personal preference (more common on Macs). It would be good to use a text editor. I use BBEdit (barebones.com), but it's expensive and overkill for this. They also make TextWrangler ($50). There's a new free editor, named Smultron, which seems fairly good, Cocoa-based (versiontracker.com). Or any editor you want. The two approaches are, basically: 1. Use a high-end text editor to "munge" the data extensively so that it imports directly into the FileMaker fields. This will involve using "grep." or 2. Use a low-end editor to just do the carriage returns, and add field separators, as mentioned earlier, then import into a temporary FileMaker file and create scripts to validate and move data to what you think are the right fields. Both methods require some work. Either will be better than manually fixing "tons" (ie., >2000) of names/addresses. What I see as a possible pattern for either method is that fact that different blocks of text have different number of lines. It appears that the 3 line blocks would all follow the same rule. The 4 and 5 line blocks may not have a consistent pattern however. If they did, then it would be fairly simple to know where things went by just seeing how many fields (columns) had data in them in each record (block). A looping script could therefore take any record of the temp file, see how many fields had data, then set the appropriate fields in a final file. Perhaps it could look for other characteristics, such as whether there was a number in the field. It's hard to say without seeing a larger sample of the data. These address blocks can be devilish; but by carefully going for patterns you can usually get almost all the data right. Feel free to attach a larger sample text file for us to look at (but maybe not the whole thing :-) The 3 above are too easy; I'm sure there's more to it.
Recommended Posts
This topic is 7663 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now