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 UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-23-2008
ali560045's Avatar
ali560045 ali560045 is offline
Registered User
 

Join Date: Oct 2007
Posts: 299
simple script help

TZ=`date +%Z`+24 ; a=`date +%Y-%m-%d`-----------greps 1 day ago date........

but this command greps date in files for 1 day ago date........even the current date is found inside the file.....

is there any logic using this command that it will grep the last date entry made in file ,whether it is current date or 1 day ago date or 2 day and likewise ?

here is the script
---------------------------------------------------

TZ=`date +%Z`+24 ; a=`date +%Y-%m-%d`

for i in *.log*
do
echo "Processing for $i"
count=0
count=`cat $i | grep $a | wc -l`
echo $i >> file1.txt
echo "the last date entry made in file1 is $a" >> file1.txt

done
Reply With Quote
Remove advertisements
!!
Forum Sponsor