Christopher Sawtell wrote:
off the top of my head - fully GPL - i.e. don't get cross if it's not a cut
and paste solution.
Cross... this is so frustrating that I don't have time to get cross! :)
The cut and paste solution...
[EMAIL PROTECTED] shared]# iptables -L traffic_in -vnx | awk '{if
(int($1)!=0) print "INSERT INTO oncs.tblData (IPAddress, DataUsed)
VALUES (\""$8"\","$2");"}'
INSERT INTO oncs.tblData (IPAddress, DataUsed) VALUES
("192.168.3.152",1737596);
INSERT INTO oncs.tblData (IPAddress, DataUsed) VALUES
("192.168.3.183",35295897);
INSERT INTO oncs.tblData (IPAddress, DataUsed) VALUES
("192.168.3.137",17449146);
[EMAIL PROTECTED] shared]#
I'm going to pipe this to a text file then import it back in to mySQL.
Thanks for your help, it's the specific syntax that I've been having
trouble with rather than the program logic.
I spent half an hour on skype chatting with Tusker (GPLHost) who
suggested I use awk to just make sql insert statements.
See: http://www.tcn.bowenvale.co.nz/content/view/48/39/
I've put a diagram on line showing what I'm trying to do.
Thanks for your help Chris
Cheers Don
--
Don Gould
www.thinkdesignprint.co.nz - www.tcn.bowenvale.co.nz -
www.bowenvale.co.nz - www.hearingbooks.co.nz - www.buxtonsquare.co.nz -
SkypeMe: ThinkDesignPrint - Good ideas: www.solarking.co.nz