Computing.Net > Forums > Programming > I need a script for parsing data :)

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

I need a script for parsing data :)

Reply to Message Icon

Name: afcmon
Date: August 7, 2006 at 10:54:03 Pacific
OS: Mac osx
CPU/Ram: G4
Product: Apple
Comment:

I need a script that I can run from a Unix command line
that takes an input file and writes an output file. I am
willing to pay someone to write it if it's more complicated
than someone wants to tackle in a minute. :)

The input file looks like this:

VALASSIS
500573500827 Alavert, any $2 (12-31-06)
500573512936 Alavert, 24 ct.+ $4 (12-31-06)
500005510769 Caltrate, any $1 (11-30-06)
550000140768 Carnation Instant Breakfast Powder or
Ready-to-Drink , any $1 (11-6-06)
500005411769 Centrum, any except 30 ct. $1
(10-31-06)
571249673749 LOreal Acne Response $5 (10-29-06)
541058992010 Schick Intuition 3 ct. Cartridge Pk FREE up
to $9.99 wyb any Schick Intuition Razor (9-9-06) .50 each
563435100504 Scotties Facial Tissues .50/3 boxes or one
multipack (11-30-06)

The output file is delimiting the fields for upload into a
database. The input file is not always exactly consistent,
hence the complications. The basic line would look like
this:

"V";"500573500827";"Alavert, any";"$2";"12-31-06"

The "V" is from Valassis on the first line of the file.

As you can see, the dollar amount isn't always preficed
with a $ sign, so it can't just read everything up to the $
sign and include it in the description. It could be .50 or .
50/3 or .75. So I'm not sure how to fix that - unless
another script ran first that looked for all the possibilities
(of .50, .50/1, etc) and inserted a $ before it.).

Anything after the date in parentheses should be ignored.
Anything that has FREE in the line should be sent to an
exception file.

Whew! Any questions, please ask! :) And thanks a
million for even attempting this! :)




Sponsored Link
Ads by Google

Response Number 1
Name: hoi polloi
Date: August 9, 2006 at 23:11:11 Pacific
Reply:

Not sure what you want your output to do, but have you considered entering the input to an HTML web form?
That way the input can be saved to a database such as MySQL,as a CSV file, or whatever.

Output can be to a screen, e-mail, text file, etc.

Perl scripts will also do a similar job.

You can get Apache, PHP, MySQL for a Mac:
http://www.mamp.info/en/home/


Also, some shopping cart scripts allow product descriptions, prices, changes, etc.
An example is Roman Cart. Take a look here:
http://www.romancart.com/locale/integration.htm#z

May be on the wrong track, tryingto get a feel for what you want to achieve.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: I need a script for parsing data :)

i need a script www.computing.net/answers/programming/i-need-a-script/18833.html

I need a script. Kinda Urgent. www.computing.net/answers/programming/i-need-a-script-kinda-urgent/7448.html

i need a Perl interpter for XP www.computing.net/answers/programming/i-need-a-perl-interpter-for-xp/4301.html