ls -l /u02/volestlivelogs01/oradata/ESTDB/archive/*.dbf | sed -e "s/:/ /g" -e "s/ / /g" | perl -lane 'BEGIN {%hash=();} $hash{"$F[5]$F[6]-$F[7]:00"}+= $F[4]; END {foreach $k (sort keys %hash) {print "$k " . int($hash{$k}/(1024*1024)) . " Mb"; } }' |
Friday, 27 February 2009
Perl one-liner to summarize file sizes
Posted by
Ook
at
03:18
0
comments
Total size of an arbitrary list of files
ls -lrt | grep "Feb 17" | awk '{tot += $5;ct +=1; print $9 " " $5/(1024*1024) "Mb"} END {printf(" Files : %s TOTAL SIZE %4.2f Gb\n",ct,tot/(1024*1024*1024))}' Remove files ls -lrt | grep "Feb 19" | cut -d":" -f2 | cut -d" " -f2 | xargs rm -rf |
Posted by
Ook
at
03:17
0
comments
Wednesday, 18 February 2009
Total size of an arbitrary list of files
ls -lrt | grep "Feb 17" | awk '{tot += $5;ct +=1; print $9 " " $5/(1024*1024) "Mb"} END {printf(" Files : %s TOTAL SIZE %4.2f Gb\n",ct,tot/(1024*1024*1024))}' |
Posted by
Ook
at
14:41
0
comments
Friday, 30 January 2009
Oracle : Display refcursor content in SqlPlus or Toad
Proc to xml-ify the refcursor create or replace procedure refcursor_print (p_refcursor in sys_refcursor, p_null_handling in number := 0) as l_xml xmltype; l_context dbms_xmlgen.ctxhandle; l_clob clob; l_null_self_argument_exc exception; pragma exception_init (l_null_self_argument_exc, -30625); procedure print (p_msg in varchar2) as l_text varchar2(32000) := p_msg; begin loop exit when l_text is null; dbms_output.put_line(substr(l_text,1,250)); l_text:=substr(l_text, 251); end loop; end print; begin /* Purpose: print debug information (ref cursor) Remarks: outputs weakly typed cursor as XML */ /* get a handle on the ref cursor */ l_context:=dbms_xmlgen.newcontext (p_refcursor); /* # DROP_NULLS CONSTANT NUMBER:= 0; (Default) Leaves out the tag for NULL elements. # NULL_ATTR CONSTANT NUMBER:= 1; Sets xsi:nil="true". # EMPTY_TAG CONSTANT NUMBER:= 2; Sets, for example, <foo/>. */ /* how to handle null values */ dbms_xmlgen.setnullhandling (l_context, p_null_handling); /* create XML from ref cursor */ l_xml:=dbms_xmlgen.getxmltype (l_context, dbms_xmlgen.none); print('Number of rows in ref cursor: ' || dbms_xmlgen.getnumrowsprocessed (l_context)); begin l_clob:=l_xml.getclobval(); print('Size of XML document (anything over 32K will be truncated): ' || length(l_clob)); print(substr(l_clob,1,32000)); exception when l_null_self_argument_exc then print('Empty dataset.'); end; end ; Call like this Nb returns a refcursor into c1 Output via dbms_output c1 sys_refcursor; begin get_refcursor_with_some_params('X1001',TO_DATE('12/02/2008','DD/MM/YYYY'),c1); refcursor_print(c1); end; |
Posted by
Ook
at
06:09
0
comments
Labels: Oracle
Wednesday, 28 January 2009
Rdesktop under linux into a Cisco VPN
IPSec gateway IPSec ID IPSec secret ### Put your username here Xauth username Xauth password
Misc Putty - selection cursor shows up black on black - change the mouse pointer on the remote machine to something more usable (Control panel -> Mouse->Pointers Tab->Text Selection) |
Posted by
Ook
at
07:36
0
comments
Labels: Linux
Friday, 23 January 2009
Conficker related links
Stopping Autorun http://nick.brown.free.fr/blog/2007/10/memory-stick-worms.html How to disable the use of USBs (MS) http://support.microsoft.com/kb/823732 |
Posted by
Ook
at
09:29
0
comments
Monday, 19 January 2009
Windows: Remote query for installed patches
wmic /user:Administrator /password:,password> /node:"spread-00811" qfe | find /N "KB958644" |
Posted by
Ook
at
06:35
0
comments
Subscribe to:
Posts (Atom)