grep using date format

i have a process ruuning

root 843786 835648 0 Nov 10 - 0:31 java
root 860340 1 0 Nov 11 - 0:31

then how to grep this using date above

i have written a script
----------------------------
#!/bin/ksh

a=`date +"%m-%d"`
ps | grep root | grep "$a" >> file1
------------------------------------------------

but not getting anything in file1,
plz tell me how to grep this process using the above date and put in file1

Try

a=`date +"%b-%d"`

%m returns the month number not the abreviated month name

still not gettin the contents in file "dates"

-------------------------------------------------------------

#!/bin/ksh

a=`date +"%b-%d"`
ps | grep root | grep $a >> dates
--------------------------------------------------------------
these are the process :

root 3694688 7503998   0   Nov 03      -  0:12 /usr/bin/iostat -d 30 
root 7200814 7503998   0   Nov 03      -  0:08 ./ifstat 30 10 
root 7209086       1       0   Jun 14      -  4:20 /usr/sbin/cron 
root 7503998 3117144   0   Nov 03      -  1:11 ./stat_daemon 9 
root 7663756 7503998   0   Nov 03      -  2:10 ./nfs_stat AIX 30 

----------------------------------------------------------------------
can u tell me how to grep the process acording to the above dates .
Actually i m able to create the file "dates" but its empty.............
i think some problem lies in my script in

a=`date +"%b-%d"`

Just execute the date command you are using and compare its output to what you are trying to match (does it have a "-" in it?).
Also, check which options you are trying to print in your date (use the command "man date").

the date is like "nov 23"

how to grep this

try to use this code

#!/bin/ksh
a=`date +"%b %d"`
ps -ef | grep root | grep "$a"

Your command

a=`date +"%m-%d"`

has a "-" between the month and the date, but you are trying to match it to something that has a space there.

So

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

should work.

i have the process:
----------------------------------------------------------------------

pipe 7151638 1482862   5 12:17:13      - 21:05 java -D_AppName=DBSyncControllerRerun com.eMeter.dbsync.server.DBSyncServer /home/pipe/conf/appProperties/DBSyncControllerRerun.properties 

pipe 1749064 983078 0 04:17:44 pts/1 0:00 grep java
-----------------------------------------------------------------------
and the script
#!/bin/ksh

for i in DBSyncControllerRerun
do
a=0
a=`date +"%T"`
ps -aef | grep java | grep $a >> dates
done

----------------------------------------------------------------------

i want to grip the process using time as 12:17:13. but this script not able to function properly,,,,,,,,,,,,,,,.this time is the strating time of that process.
the o/p of this its showing is

pipe 1749064 983078 0 04:17:44 pts/1 0:00 grep java

but i want this o/p

pipe 7151638 1482862 5 12:17:13 - 21:05 java -D_AppName=DBSyncControllerRerun com.eMeter.dbsync.server.DBSyncServer /home/pipe/conf/appProperties/DBSyncControllerRerun.properties

A useful debug method is to echo the variables (eg. echo "$a"), so you can see what they actually are.
Alternatively, you can run your script with the shell "-x" option (eg. sh -x myscript).