grep using date format

i have few persistance apps like below

pipe 1118370 1200312 0 Dec 18 - 192:03 java - _AppName=DBSyncController

pipe 2523376 1568906 0 feb 25 - 386:15 java -Xms128m -Xmx1024m -D_AppName=DBMaint com

pipe 7462996 2531452 0 march 18 - 23:22 java -D_AppName=Interpolation

pipe 3379242 7631092 0 may 18 - 27:50 java -D_AppName=Archiver2
-----------------------------------------------------------------------

i want to grep these apps using the above date format.i have written the script but its showing me todays date as dec 24

#!/bin/ksh

if test -f dates
then
rm dates
else
echo " "
fi

for i in DBSyncController DBSyncControllerRerun Archiver1 DBSyncListener Archiver2 Cleaner1 Interpolation
do
a=0
a=`date +"%h %d"`
echo $a "\t" $i >> dates
done
echo "--------------------------------------------------------------------------------------------------------------------" >> dates

for i in DBSyncController DBSyncControllerRerun Archiver1 DBSyncListener Archiver2 Cleaner1 Interpolation
do
a=0
a=`date +"%h"`
ps -aef | grep java | grep "$a" | grep $i >> dates
done
----------------------------------------------------------------------

i think some problem in date logic,help me in this

I didn't Understand what you mean above date format. Do you mean
Mount Day - hour:second. What about the other date format that you don't want to catch in your ps -ef command. Besides that you can not use
date in this example date means todays date. if you send your ps -ef command's output which shows the date format that you want to catch and also the ones you dont want to catch together we can find the solution

Your requirements are somewhat unclear. If you want to capture the date in the
format outputted by ps, here is one way of doing it.

Create a file (e.g. date.awk) containing the following lines

  /java/ && /DBSyncController/ { print $5, $6 }
  /java/ && /DBSyncControllerRerun/ { print $5, $6 }
  /java/ && /Archiver1/ { print $5, $6 }
  /java/ && /DBSyncListener/ { print $5, $6 }
  /java/ && /Archiver2/ { print $5, $6 }
  /java/ && /Cleaner1/ { print $5, $6 }
  /java/ && /Interpolation/ { print $5, $6 }

and then replace your loop with

ps -aef | awk -f date.awk >> dates

actually wats the date format to be used ,if date is like march 20,feb 12.and like wise

how do u grep this word in below logic

a=`date +"%h %d"`

outputs of ps are columns of strings,parameters. You can not use date as you intend, you must use a way like fmurphys. Firts send all or a sample part of output oF ps -ef with no grep " I mean ps -ef " . Point out our underline the lines that you want. After this say what will you do with this output. Then I thing the solution will be simple