En cours

Parse Text file to mysql db - simple

I need a program which will parse a file and write to a db

file to parse /var/log/asterisk/[url removed, login to view]

Every line is date and stimestamped

So we only want to parse lines which are newer than now()-10 min

db has no username or passw

all variable must be on top of script for easy editing.

[parse1]

| balance | varchar(8) | NO | | NULL |

| name | varchar(50) | YES | | - |

parse1_db = [url removed, login to view]

parse1_string= " balance is @b@ and"

This means if you see a string like

12-08-04 17:24:10 USB504 Top up 30 or more for a chance to match,double or triple it in bmobile's Go for Gold [url removed, login to view] account balance is [url removed, login to view] and expiry date is 2012/12/03 from ussd

mark in asterisk.trunks_trunk.balance='[url removed, login to view]' where name='USB504' < USB value can vary but always starts with USB and comes right after time stamp.

[parse2]

| Field | Type | Null | Key | Default | Extra |

+------------+-------------+------+-----+-------------------+-------+

| scid | varchar(25) | YES | UNI | NULL | |

| gsm_number | varchar(15) | YES | | NULL | |

| atime | timestamp | NO | | CURRENT_TIMESTAMP | |

+------------+-------------+------+-----+-------------------+-------+

parse2_db=sim_bank.scid_gsm

parse2_string= "USBxxx @scid@ scid from @gsm@"

This means. If you see a string like

2012-08-04 18:43:36 USB507 12365464874654 scid from +18684642370

you do. Insert into scid_gsm values (12365464874654,+18684642370) <only if scid does not already exist in table.

Compétences : AJAX, Linux, MySQL, Perl, PHP

Voir plus : text string, text now, string match, php script null, mysql db, match string, mysql top, asterisk mark, ussd, triple, time stamp, sms asterisk, asterisk script gsm sms, key value extra, insert variable, insert txt, perl sms script, write mysql, file exist, insert mysql table, promo text, mysql date field, variable mysql, mysql table text insert, text table

Concernant l'employeur :
( 87 commentaires ) dix hills, United States

N° du projet : #2377074

5 freelance ont fait une offre moyenne de 82 $ pour ce travail

dustafo

I can get this done for you.

100 $ USD en 2 jours
(73 Commentaires)
5.4
webexpert80

Hi, simple task and I can complete it very quickly. Data can be parsed using regular expression for exact matching. Thanks.

30 $ USD en 1 jour
(11 Commentaires)
4.1
imangh

I'm Expert Php/MySQL and used PHP as CLI for many projects. Check your PMB for details please.

80 $ USD en 1 jour
(26 Commentaires)
4.0
armandogomes

I think I'm able to do it.

100 $ USD en 2 jours
(2 Commentaires)
3.5
yoniasmo

Redy to do it

100 $ USD en 2 jours
(0 Commentaires)
0.0