• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to parse a text file  RSS feed

Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

What you see below stars-line is the type of data i am working with.
I have a lot of file like that. Initially, i don't know what the files look like.
It is the user of the application that has to input the files.
The user first gives example data to the system. ie. The user can give as example:
Name: Jhon Smith
Address: 36, abcd avenue, Paris

My application has to know how to parse the file, so it puts the data in a database.
As you can see, using simple delimitters (eg: space, comma,...) or regular expressions will not work.

Does anyone has an idea how to appoaroch this problem?

I am opened to any type of suggestion.


name id beer_style first_brewed alcohol_content original_gravity final_gravity ibu_scale country brewery_brand color_srm from_region containers
Bramling /m/0cttpqn 4.0 Buntingford Brewery
Dark Star Hophead Extra /m/0dl8hjd 5.8 Dark Star
Brewers Gold /m/0cttps0 Bitter 4.0 Crouch Vale Brewery
Wem Brewing Company Cascade Bitter /m/0dlfhn2 Wem Brewing Company
Friedrich Dull Krautheimer Urtyp Dunkel /m/04dqd7m 5.4 Friedrich Dull Germany /m/04dr2qr
Nethergate Umbel Ale Coriander Beer /m/04dqf7b 3.8 Nethergate brewery United Kingdom /m/04dr00w
Skinner's Cornish Gold /m/04dqmzy 5.1 Skinner's Brewery United Kingdom /m/04dr1kh
Brouwerij Martens Damburger Export /m/04dqrz0 5.1 Brouwerij Martens Belgium /m/04dr6cb
Concord Brewers Rapscallion Premier /m/04dqt4r 6.75 Concord Brewers United States of America /m/04dr2fm
Federation High Level Strong Brown Ale /m/04dqhp1 4.5 Federation United Kingdom /m/04dr2n_
Chiltern Brewery Glad Tidings Spiced Milk Stout /m/04dqv4g 4.6 Chiltern Brewery United Kingdom /m/04dr57q
Huisbrouwerij Klein Duimpje Hillegoms Tarwe Bier /m/04dqhd9 5.0 Huisbrouwerij Klein Duimpje Netherlands /m/04dqztr
Wickwar Infernal Brew /m/04dqfy6 4.8 Wickwar United Kingdom /m/04dq_9r
Schöfferhofer Hefeweizen /m/04dqtxc 5.0 Schöfferhofer Germany /m/04dr0zh
Woodforde's Nelson's Revenge /m/04dqqg3 4.5 Woodforde’s Brewery United Kingdom /m/04dr6c6
Ridgeway Santa's Butt Winter Porter /m/04dqlpv 6.0 Ridgeway United Kingdom /m/04dqzdh
De Proefbrouwerij Kapel van Viven blond /m/04dqjhh 6.8 De Proefbrouwerij Belgium /m/04dr28r
Ventnor Wight Spirit /m/04dqkb9 5.0 Ventnor United Kingdom /m/04dr6h2
Wye Valley Brewery O'er The Sticks /m/04dqkxg 4.5 Wye Valley Brewery United Kingdom /m/04dr6w2
Cannery Blackberry Porter /m/04dqbfw 8.0 Cannery Canada /m/04dr4s5
Maclay Thistle MacKinnon's Curse (Asda) /m/04dqfzr 4.1 Maclay Thistle United Kingdom /m/04dr58z
Alcazar (Sherwood Forest Brewery Co) Maiden's Magic /m/04dq9h7 5.0 Alcazar (Sherwood Forest Brewing Co) United Kingdom /m/04dq_hm
Molson Stock Ale /m/04dqqkm 5.0 Molson Canada
Hirter Privat Pils /m/04dql0d 5.2 Hirter Austria /m/04dr2tr
Lodzkie (subsidiary of Kaltenberg) Glob Premium /m/04dqd05 5.5 Lodzkie (subsidiary of Kaltenberg) Poland /m/04dqxcr
Batemans Spring Breeze /m/04dqgsb 5.0 Batemans Brewery United Kingdom /m/04dr023
Wylam Toon Ale Brunette /m/04dqf1f 4.8 Wylam Brewery United Kingdom /m/04dr0q7
Brouwerij 't IJ Vlo /m/04dqvww 7.0 Brouwerij 't IJ Netherlands /m/04dqywr
Roman Ename Tripel /m/04dqt36 9.0 Roman Belgium /m/04dr2xw
De Leckere Tripel /m/04dqk96 8.0 De Leckere Netherlands /m/04dr6_6
Haacht Charles Quint/Keizer Karel /m/04dqk4v 9.0 Haacht Belgium /m/04dq_tm
Integrated Bottling Solutions Hazy Days /m/04dqj6k 3.9 Integrated Bottling Solutions United Kingdom /m/04dr0wc
Usher's White Ale /m/04dqsbh 6.5 Usher's United Kingdom /m/04dr3l4
Robinson's Top Tipple /m/04dqwpg 3.9 Robinson's Brewery United Kingdom /m/04dqxz3
Broughton Ales Merlin's Ale /m/04dqd1q 4.2 Broughton Ales United Kingdom /m/04dq_37
Copper Dragon Brewery Black Gold /m/0dl8hft Mild ale 3.7 Copper Dragon Brewery
Dark Star Old ale /m/0dl8hk4 4.0 Dark Star
Abbey Ales Bath Star /m/0djv0x0 Bitter Abbey Ales Brewery
St. James Irish Red Ale /m/063wb2t Irish red ale Walnut Brewery
Island Lager /m/05khjyc Lager 5.0 Granville Island Brewing
Tooheys Old /m/07qzs6 1869 4.4 Tooheys Australia
Creemore Springs /m/02mjg8 Lager,Pilsener,Bock 1987 Canada
Ommegang Hennepin /m/02hv3dd Saison Brewery Ommegang
James Squire Hop Thief /m/03m2n3j Australia
Meyer E.S.B. /m/063hm84 Extra Special/Strong Bitter Thirsty Bear Brewing Company
Otley CO2 /m/0djz9_0 Special/Best/Premium Bitter Otley Brewing Company Limited
Otley O8 /m/0djz9zy Barley wine Otley Brewing Company Limited
Saint Arnold Divine Reserve 10 /m/0ghtv0j English Barleywine 2010 11.0 1.101 1.018 Saint Arnold Brewing Company United States of America /m/0ghtv1y
Otley Dark-O /m/0djz9_9 Mild ale Otley Brewing Company Limited
First Lightning /m/0cttpnj 4.6 Atomic Brewery
Jarrow Brewing Company Jobling's Swinging Gibbett /m/0dlfhxy 4.1 Jarrow Brewing Company
Vale VPA /m/0dkfs82 Vale
Darwin Brewery Hop Drop /m/0dl8hr3 5.3 Darwin Brewery
Franziskaner Hefe-Weisse Hell /m/0djwwtd Weiss 1516 5.0
Rip Tide /m/0b68kjd Stout 8.0 1074.0 65.0 BrewDog /m/0b68m5h,/m/0b68lsj,/m/0b68m5q,/m/0b68lsq
John Smiths /m/03gnvjj Bitter 1847 4.0 United Kingdom
Dark Star Critical Mass /m/0dl8hhr 7.8 Dark Star
Colorado Caium /m/0djxh7m Pilsener
Nethergate Umbel Magna /m/0dkfscl Nethergate brewery
Abbey Ales Black Friar /m/0djv0xl Bitter Abbey Ales Brewery
Strangford Lough Barelegs Brew /m/04dqczw 4.5 Strangford Lough Republic of Ireland /m/04dr37j
Posts: 4686
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks to me that a regular expression will to this well. It will be a more complex expression, you will want to use groups.
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!