I'm running the mysql
cmdline binary to execute queries. (Specifically, I'm executing
LOAD DATA LOCAL INFILE
). I would like to have it print, after every statement, the number of records effected - but no other lines. I don't mind the line containing other info, e.g.
Query OK, 20 rows affected, 4 warnings
would be great. I can, in fact, get that - but only if I use the -v -v
pair of switches, and then I get more info which I don't need, like an echo of the parsed command.
Can I do anything other than grep
the output for the pattern of the line above?
It's maybe not the best solution, but you can try the SQL ROW_COUNT() function
E.g :
mysql ... -e "YOUR_QUERY;SELECT ROW_COUNT()" -B | tail -n 1