add handy log grep command
authorhttps://launchpad.net/~kralph <kralph@web>
Wed, 27 Jul 2011 07:17:57 +0000 (00:17 -0700)
committerKenyon Ralph <kenyon@kenyonralph.com>
Wed, 27 Jul 2011 07:17:57 +0000 (00:17 -0700)
One-liners.mdwn

index e2f715b..25377e2 100644 (file)
@@ -3,6 +3,7 @@
 1. [sed one-liners](http://sed.sourceforge.net/sed1line.txt)
 1. [awk one-liners](http://www.pement.org/awk/awk1line.txt)
 1. Read numbered log files (as generated by [[!debpkg logrotate]]) sequentially: `less $(echo /var/log/all.log* | tr ' ' '\n' | sort --version-sort)`
+* Look for a pattern in logs: `zgrep "pattern" $(echo /var/log/all.log* | tr ' ' '\n' | sort --reverse --version-sort)`
 1. Make an IPv6 PTR record: `echo $(host 2001:470:1f05:4ef::999 | cut --delimiter=' ' --fields=2 | cut --delimiter=. --fields=1-16) IN PTR whatever.kenyonralph.com.`
 1. Find -doc packages that aren't installed: `aptitude search '~RBsuggests:~i!~i~n-doc'`
 * Long version: `aptitude search '?and(?broken-reverse-suggests(?installed), ?not(?installed), ?name(-doc))'`