CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
grep data from text files and update into mysql


New User

Mar 2, 2010, 1:34 PM

Post #1 of 1 (3978 views)
grep data from text files and update into mysql Can't Post

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.

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)


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives