Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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! :)

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#zMay be on the wrong track, tryingto get a feel for what you want to achieve.

![]() |
![]() |
![]() |

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