Tuesday, May 29, 2012

Virtual Host or Virtual IP dig digging

cmb@pscmbldl02:~
$ dig axfr my.domain.com | grep  dje00197.my.domain.com
dje00197.my.domain.com. 21600 IN A 10.76.40.34
djeswk03.my.domain.com. 21600 IN CNAME dje00197.my.domain.com.

cmb@pscmbldl02:~
$ dig axfr my.domain.com | grep pscmbldl02
scm.my.domain.com. 21600 IN CNAME pscmbldl02.my.domain.com.
scmblog.my.domain.com. 21600 IN CNAME pscmbldl02.my.domain.com.
pscmbldl02.my.domain.com. 21600 IN A 10.75.82.3
cmb@pscmbldl02:~
$ 

Tuesday, May 8, 2012

sed: how do I grep from line X until EOF?

If I have a rolling logfile with multiple lines per log record how do I print from line X until EOF?
computer:~ me$ sed -n "57450,\$p" pf/app/logs/server/trace.log

Wednesday, May 2, 2012

SED: print only lines between x and y...

Print only lines between certain line numbers... I'm sick of looking this up every two seconds... so I plagiarize and put it in my own collection.... which I know how to find :-)
# print section of file based on line numbers (lines 8-12, inclusive) 
sed -n '8,12p' # method 1 
sed '8,12!d' # method 2
Example that I needed this for: grepping lines 39000 - 40000 where an error was reported.
computer:tmp user$ ssh user@host 'cd  /QIBM/UserData/WebSphere/AppServer/V61/ND/profiles/dmgrapp/logs/dmgr && sed -n '39000,40000p' systemout.log'

Tuesday, May 1, 2012

A poor man's DNS resolving in a perl oneliner

Silly to record this ... but I hate spending more than 60 seconds on figuring out something I already figured out before... so here we go.... my own dns resolver..... Listing the resolving of the ip range: 10.75.19.80 until 10.75.19.95
$ perl -e 'for (80..95) { open EXEC, "( nslookup 10.75.19.$_ )|"  or die $!; @l=;chomp @l; ($x) = grep {/name/} @l if @l; printf "%3d - %s\n", $_, $x }'