Mar 2, 2010, 1:34 PM
I don't know how easy this would be to find/write, but I need a quick script that will go through every file in a directory matching a certain name, pull 3 lines from it and then update it into a mysql database. Also, it will need to cut a specific number of characters off the start of each line.
grep data from text files and update into mysql
Every file will have the name 'active' in the name, and each line will output in the manner below (I need to drop everything before the '=':
serial = <value>
user = <string1>
admin = <string2>
And for the mysql it will need to:
UPDATE <table> SET user = <string1> WHERE serial = <value>
UPDATE <table> SET admin = <string2> WHERE serial = <value>
If someone could help me with this I'd really appriciate it.
(This post was edited by jeyles on Mar 2, 2010, 1:56 PM)