Advertisement
rg443

mysql import e1001.txt (loop through date)

Dec 9th, 2017
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.28 KB | None | 0 0
  1. d=2017-10-01;
  2. while [ "$d" != 2017-12-08 ]; do
  3.   f=$(date -d $d +%m%d);
  4.   echo $d, $f;
  5.   mysql -vv -e "load data infile '/home/www1/data/e$f.txt' ignore into table e17 LINES TERMINATED BY '\r\n'(ip,n,p,b,c,h) set dt='$d', i=inet_aton(ip)";
  6.  
  7.   d=$(date -I -d "$d + 1 day");
  8. done;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement