Thursday, July 8, 2010

script gado-gado biar gak lupa


script campuran, cari sendiri yah maksud dari scriptnya ^_^

find /export/home -size +10000c -exec ls -ltr {} \;
find /home/ -size 22c -name '*.zip' -exec rm -f {} \;


cat a.txt | awk '{FS=","}{sum +=$6} END {print sum}'


select /**/ column from table
select /*+ index (scott.emp ix_emp) */ scott.name,scott.address from scott.emp
select /*+ index (emp_alias ix_emp) */ ... from scott.emp emp_alias


for i in `ps -eaf | grep box | grep -iv "grep box" | awk '{FS=" "}{print $2}'`; do kill -9 $i; done;


select CAST(2.56 AS INTEGER) dec_to_intgr from dual;


# Kill Process
if [`ps -eaf | grep "ProcessIndra" | grep -v grep|wc -l` -eq 0 ]; then
echo "ProcessIndra Interface Agent is not Running." `date`
else
echo "Stopping the ProcessIndra Interface Agent at " `date`
ps -eaf | grep ProcessIndra | grep -v grep | awk {'print $2'} | xargs kill -9
fi

#===========


------for pearl get yesterday date


perl -e 'use POSIX qw(strftime); $range=3600*24*$ARGV[0]; my $date = strftime("%Y%m%d",localtime(time-$range)); printf "$date\n" ' 1