When using MySQL, you can set any pager you wish using the pager command.
mysq> pager less
PAGER set to 'less'
Using Vim as your pager allows you to quickly munge query output into whatever format you want.
mysql> pager vim -
PAGER set to 'vim -'
Thanks to Jay for the tip!
Tuesday, June 24, 2008
Subscribe to:
Post Comments (Atom)
4 comments:
I didn't know you could do paging in the mysql cli. Awesome!
Thanks, that's pretty handy. I usually would get by selecting into outfile, but this works well.
Just look for mysql pager info on: http://linux-sysadmin.org/2010/08/mysql-pager-filter-your-output/
Great tip... You can put that in .my.cnf in your own directory. I also made slight modification to make vim start in read only mode and added nowrap so see the whole table without wrapping, it ended up like this in .my.cnf
[mysql]
pager = vim -R -c "set nowrap" -
I hope this helps somebody..
Post a Comment