Monday, June 4, 2012

Adding size Column to Saved Searches

Add Size and other columns to search results ... stolen and plagiarized for my own selfish need. I was very disappointed that I couldn't add the Size column to the list view in search results. Only Date Created and Date Modified were added as options in 10.6; the others are grayed out. Fortunately, I found a way to force the Size column to appear, as well as Comments, Version and Label columns. You'll have to edit the com.apple.finder.plist file found in
~/Library/Preferences
, using the Property List Editor app (included with Xcode) or PlistEdit Pro. Open the Root node, then navigate down into
SearchViewSettings » ListViewSettings » columns
. Then choose the column you want to activate in the column list (ie. Size), and set the visible key to yes. Save the .plist and relaunch the Finder (Option-Control-click on the Finder icon in the Dock). Note: you must have done at least one search, and selected one of the additional columns in the View Options panel for the search results (Date Created, for example), or else your .plist file may not contain the SearchViewSettings node. Warning: Apple probably disabled these columns for a good reason, as there may be some bugs that could cause problems on your system. I didn't have any problems with the size column, but be warned.

Friday, June 1, 2012

Vanguard exports and Google OFX imports

Okay wanted to straighten out my finances and have one overview in Google Finance.... lets export and import. The Vanguard website will allow you to download them in a csv format which contains all the valid data according to OFX. However they forgot the symbols and put the shorthand description there.... so totally useless.... so lets parse this baby into the correct format... I only had to do 5 different sources .... but feel free to adjust or add...
:Downloads amiga$ cat ofxdownload.csv | perl -pe 's/Total Bond Mkt Index Inst/VBTIX/;s/Windsor Fund Investor/VWNDX/;s/Total Intl Stock Ix Inv/VGTSX/;s/PRIMECAP Fund Investor/VPMCX/;s/500 Index Fund Signal/VFIAX/;'

remote shell qoutes and double qoutes in complex operations

I prefer the sledgehammer when managing multiple servers. but what about quoting and double quoting and double double qouting.... escaping in on thing.... however how about this.... Here a oneliner for printing the statistics on TCP state of a box.
[dswown@pghpviswl01 ~]$ cat cmd.txt 
netstat | perl -MData::Dumper -ne 'BEGIN {%h=();} chomp;$_=~s/\s+/ /g;@x=reverse split/[\s+:]/ if /tcp|udp/; if (@x) {$x[2]=~s/\.c?\w?\w?$//g;print Dumper(\@x), $_ if $x[2] eq '8471';$h{count}{$x[0]}++;$h{$x[0]}{$x[2]}++;
} END { print Dumper(\%h)}'

[dsw@pviswl01 ~]$ cat list | xargs -i{} -t ssh {} $(<cmd.txt)

Where the file 'list' contains the following:
user1@hostA
user2@hostB

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 }'