I have a mysql database where in the NETWORK table, the IP_ADDRESS field is varchar and holds standard IP addresses in different lengths like 22.214.171.124 or 126.96.36.1996, or 123.456.789.123 etc. I need another field (i.e. IP_ADDRESS_DECIMAL) to hold their decimal values. I have seen ip2long in php but I am not sure how to use that......an ordinary bash, perl script with similar functionality will work for me. I need to put my script in a cron job. Some bash/perl script like this:
mysql -u root -pmypass mydatabase -e "UPDATE NETWORK SET IP_ADDRESS_DECIMAL = Somefunction(IP_ADDRESS);
Thanks very much.