Phillip - each section would have different "delimiters" - you should break
it down and think of each part of the text file as a separate component, and
each separate component is delimited by a blank line.

For instance the first section (pseudo code at best here obviously),
start_title = Find (Title:) ;
end_title = Find (next end of line marker, start with Find(Title:);
Insert into Database
    Title = (mid (doc, start_title, end_title)) ;
..repeat for next 2 fields..

Ingredients = getlistat(doc, 2, 'blank line');
Insert into Database
    ingredients  = #ingredients#;

....

It's not going to be a straight forward few lines of code...

-Bill
brainbox

----- Original Message -----
From: "P Broussard" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, September 25, 2001 2:38 PM
Subject: Grab formated text from file and put in database Doh!!


> Sorry, I sent it to early. :)
>
> I have some text files that were to be used in the Meal-Master program
> but now I need to put them in a database. The files are delimited but I
> am not sure how. I want Coldfusion to read the file, treat it like a
> list, and then insert it into the database. I just don't know how to
> figure out what the delimiters are. Any suggestions would be a big help.
>
>
> TIA
>
> Phillip
>
> This is what the files looks like.
>
>
> MMMMM----- Recipe via Meal-Master (tm) v8.05
>
>       Title: Thai Fried Noodles (Pad Thai)
>  Categories: Pasta, Asian, Vegetarian, Spicy, Thai
>       Yield: 4 servings
>
>       3 tb Oil
>       2 oz Ready-fried beancurd
>            - (or more),
>            - cut into 1/2 cubes
>       1    Egg
>       4 oz Flat noodles; cooked
>       1 tb Chi po (preserved turnip)
>            - (finely chopped)
>       2    Spring onions; in 1" pieces
>       2 tb Chopped roasted peanuts
>       3 oz Beansprouts
>     1/2 ts Chili powder
>       1 ts Sugar
>       2 ts Light soy sauce
>       1 ts Lemon juice
>            Lime wedge (for garnish)
>            Sprig of fresh coriander
>            - (for garnish)
>
>   In a wok of frying pan, heat oil.  Add garlic & fry til golden brown.
>   Add ready-fried beancurd and stir.  Break egg into wok, cook for a
>   moment, then stir.  Add cooked noodles, stir, then add turnip and
>   spring onions & half of peanuts and half of beansprouts.  Stir well;
>   add chili powder, sugar, light soy sauce, and lemon juice.  Stir well
>   & turn on to a plate. Sprinkle with remaining peanuts and chopped
>   coriander leaf. Arrange remaining beansprouts & lime wedge on side of
>   plate.
>
>   (From Thai Vegetarian Cooking, Vatcharin Bhumichitr,Clarkson Potter
>   Pub)
>
>   Posted by Lorena Horton in Fidonet Intercook
>
> MMMMM
>
> MMMMM----- Recipe via Meal-Master (tm) v8.05
>
>       Title: Fried Rice with Basil (Khao Pad Krapow)
>  Categories: Thai, Vegetarian, Vegan, One dish, Main dish
>       Yield: 2 servings
>
>       1    Garlic clove; finely chopped
>       3 sm Fresh red or green chilis
>            -- finely chopped
>       1 c  Fresh button mushrooms
>            -- halved
>       1 sm Onion; chopped
>       2 c  Cooked rice
>       1 sm Bundle long beans
>            -OR- French/snap beans
>            -- cut into 1/2" pieces
>       1 sm Red or green pepper; diced
>     1/2 ts Sugar
>       3 tb Light soy sauce
>      15    Sweet basil leaves
>
>   In a wok or frying pan/skillet, heat the oil until a light haze
>   appears. Add the garlic and chilis and fry until the garlic is golden
>   brown. Add the mushrooms and onions and stir quickly.  Add the cooked
>   rice and stir thoroughly.  Add the long beans, peppers, sugar and
>   light soy sauce and stir thoroughly.  At the last moment quickly stir
>   in the basil leaves and turn on to a serving dish.
>
>   Source: Thai Vegetarian Cooking by Vatcharin Bhumichitr Typed for you
>   by Karen Mintzias
>
> MMMMM
>
> MMMMM----- Recipe via Meal-Master (tm) v8.05
>
>       Title: Hot & Sour Chicken Soup
>  Categories: Thai, Poultry, Soups
>       Yield: 8 Servings
>
>       4    Chicken Breasts *
>       4 tb Soy Sauce
>       1 tb Salad Oil
>       6 c  Water
>     3/4 ts Ground White Pepper
>       3 tb White Wine Vinegar
>     1/4 lb Snow Peas
>       1    Red Pepper, Thin Strips
>       8 oz Bamboo Shoots, Drained
>       2    Chicken Bouillon Cubes
>       1 lb Firm Tofu, Cut Bite Size
>     1/3 c  Cornstarch
>       2    Eggs
>       1    Green Onion, Thinly Sliced
>
>   * Chicken breasts should be skinned and boned.
>   ~---------------------------------------------------------------------
>   ~-- Cut the chicken into 1/8 in. slices.  Stir the chicken slices
>   with 1 T soy sauce in a bowl.  Cook chicken in oil in 5 qt. dutch
>   oven until tender, about 3 min.  Remove the chicken, add the
>   remaining soy sauce to pan with next seven ingredients, and heat to
>   boiling, stirring frequently. Reduce heat to low and simmer for 10
>   min. or until veg. are tender. Add chicken and tofu, bring to boil
>   over medium heat. Stir cornstarch and 1/3 c. water in small bowl
>   until smooth. Gradually add the mixture to the simmering soup until
>   slightly thickened and smooth. Beat the eggs in a small bowl and
>   slowly pour into soup, stirring gently until set. Top with green
>   onion. From: Terri Woltmon                   Date: 04-15-94 (20:09)
>   Number:
>       208    From
>
> MMMMM
>
>
>
>
>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to