Skip to content

Instantly share code, notes, and snippets.

@labeneator
Created October 10, 2013 13:57
Show Gist options
  • Save labeneator/6918794 to your computer and use it in GitHub Desktop.
Save labeneator/6918794 to your computer and use it in GitHub Desktop.
-- Loads IPs as an unsgined int (create table :: ip int(10) unsigned NOT NULL)
-- Trims out the zulu time timezone indicator 'Z' e.g. (2013-07-31T18:41:38Z,).
-- See http://en.wikipedia.org/wiki/Coordinated_Universal_Time
load data local infile 'xxxxx'
into table blah
fields terminated by ','
ignore 1 lines
(a, @ip, b, @ts1, @ts2)
set ip=inet_aton(@ip),
ts1=replace(@ts1, 'Z', ''),
ts2=replace(@ts2, 'Z', '');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment