The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 06-06-2009
aemunathan aemunathan is offline
Registered User
  
 

Join Date: May 2008
Posts: 76
Hi

Thanks a lot man...its nice to see the result...

I need one more info. actually am using sqlloader to insert the result in to a table. Here i want to print the previous date as well in dd-mon-yyyy format

i tried in this way

Code:
#!/bin/ksh

dat=$(./datecalc -a $(date +"%Y %m %d") - 1)

da_te=$(date +'%d')

da=$(($da_te-1))

mon=$(date +'%b')

year=$(date +'%Y')

host=$(hostname)

day=$(/usr/xpg4/bin/awk -v d="$dat" 'BEGIN {split(d,a," ");day=sprintf("%s%02s%02s",a[1],a[2],a[3]);print day}')

/usr/xpg4/bin/awk -v d="$day" -v serv="BSNLSERVICE1" -v val="2128"  -v daet="$(($da)-($mon)-($year))" -v ho="$host"'
$1~day && $4==serv && $6==val {
  s1++
}
END{
  print daet, host,s1 
}' $day*

Help me out !!!! the report is of previous day so i need to use the previous date while printing.
Thanks in advance

Last edited by aemunathan; 06-07-2009 at 02:36 PM.. Reason: one more requirement!!!!!!