I am trying to make sense of a comma delimited log file in which multiple lines make up 1 record. Here is an example:
A,W29073,Thu Apr 05 15:25:08 2001 B,W29073,Scott,S,[EMAIL PROTECTED],249 Tah Ave,,Sth San Francisco,CA,~US,55555-5555 P,W29073, X,W29073,Company Name,A,Department Name,San Francisco 00),Purchase Order Number,254 S,W29073,UPS Next Day Air,Scott S,2 Tah Ave,,Sth San Francisco,CA,~US,55555-5555 I,W29073,AVHQ_101090lfbl,6.000,$28.50,$171.00,,,,1.00,,2,0 I,W29073,AVHQ_101090xlfbl,4.000,$28.50,$114.00,,,,1.00,,3,0 T,W29073,$285.00,,,,$53.09,$338.09,,10.00, A,W29101,Wed Apr 11 07:43:33 2001 B,W29101,harold,m,[EMAIL PROTECTED],10 wind ridge parkway,,Atlanta,GA,~US,55555 P,W29101, X,W29101,Company Name,,Department Name,,Purchase Order Number,10252 S,W29101,UPS Regular Ground,harold m,10 wind ridge parkway,,Atlanta,GA,~US,55555 I,W29101,ADV_Carb-Natxxl,1.000,$16.50,$16.50,,,,1.50,,4 T,W29101,$17.50,,7.000,$1.23,$9.28,$28.01,,1.50, A,W29116,Thu Apr 12 11:42:21 2001 B,W29116,test,test,[EMAIL PROTECTED],test,,test,GA,~US,11111 P,W29116,Credit,Offline,Visa,4444444444444444,04/04,,,, X,W29116,Company Name,,Department Name,,Purchase Order Number, S,W29116,UPS Regular Ground,test test,test,,test,GA,~US,11111 I,W29116,ADV_1601,1.000,$14.00,$14.00,,,,1.50,,3 T,W29116,$14.00,,7.000,$0.98,$9.94,$24.92,,1.50, Here's what I know: I am trying to get a list of email addresses for people who have ordered products that begin with ADV I know that the second field is the order number that ties all of the lines for one order together. I know that each block always starts with and A in the first position of the first line and ends with a T in the last position of the last line. I know that the second line starts with a B, and the data in the 5th space on this line is the e-mail address, which is what I ultimately want. However,... I am trying to get a list of email addresses for people who have ordered products that begin with ADV. These can appear in multiple I lines. Therefore you can never predict how many lines make up 1 order block. I can handle all of the pieces except for the parsing of files that have each complete record on its own line. The problems is that the records are split across multiple line and the # of lines can increase based on how many line items (I rows) there are on the order Can anyone offer me some direction? Should I try to leave these lines separate? Should I try to start each line with A and then put each of the subsequent lines end to end until I hit another "A?" Thanks, Andrew Andrew Hughes Insider's Advantage Webmaster Phone: (404) 575-6389 Fax: (404) 575-6374 "Online ordering is now available. Visit http://insidersadvantage.com for details." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>