====================
How to get execution time bw 2 statements in a shell script:
====================
t1=$( perl -e "print time")
sleep 10
t2=$( perl -e "print time")
timeConsumed=$(($t2-t1))
echo "time taken : $timeConsumed"
====================
find and delete files older then 10 days
====================
find subdebt*.dat.Z -mtime +00 -exec ls -lrt {} \;
find *.* -mtime +10 -exec rm -f {} \;
How to get execution time bw 2 statements in a shell script:
====================
t1=$( perl -e "print time")
sleep 10
t2=$( perl -e "print time")
timeConsumed=$(($t2-t1))
echo "time taken : $timeConsumed"
====================
find and delete files older then 10 days
====================
find subdebt*.dat.Z -mtime +00 -exec ls -lrt {} \;
find *.* -mtime +10 -exec rm -f {} \;
====================
use of awk command
====================
tabname=ENH_BAAC
rows_deleted=10323244
enh_age=56
echo TABLE_NAME ROWS_DELETED ENH_AGE | awk '{printf "%-30s %-20s %-20s \n",$1,$2,$3 }' >test
echo $tabname $rows_deleted $enh_age | awk '{printf "%-30s %-20s %-20s \n",$1,$2,$3 }' >>test
tabname=ENH_LETTERS_OF_CREDIT
rows_deleted=0
enh_age=98
echo $tabname $rows_deleted $enh_age | awk '{printf "%-30s %-20s %-20s \n",$1,$2,$3 }' >>test
cat test
====================
Extension of file
====================
ls /v/region/na/appl/corptsy/lmfr/data/qa/sourced/brm_repo/History/20120730.20120803.174759.dat.Z | read file
echo ${file##*.}
file="thisfile.yogesh.txt"
echo "filename: ${file%.*}"
echo "extension: ${file##*.}"
====================
For loop
====================
for i in 2 3 4 5 6
do
export DB2NODE=$i
db2 terminate
db3 connect to nypd_lmfr
db2 load query table liquidity.ETL_UK_MORtGAGES
done
====================
If Else Stmt
====================
PREV_TABNAME=dummy1
if [ "${PREV_TABNAME}" != "dummy" ]; then
echo $PREV_TABNAME
else
echo "incor"
fi
====================
Cut Command: to get 4th col with delimeter as |
====================
cut -d "|" -f-4 test
No comments:
Post a Comment