Question : KSH: Extracting lines that have first Word in the predefined list

Here is logfile:

Wed Jul 21 16:01:00  ......
aaaaaaaaaaaaaaaaaxxxx
bbbbbbbbbbbbbbbbbyyyy
cccccccccccccccccccccc4444  directory:/xxxx/yyyy/dddd/1234.log
Wed Jul 22 02:00:03 ......
aaaaaaaaaaaaaaaaaa1111
bbbbbbbbbbbbbbbbbb2222
cccccccccccccccccccccc5555  directory:/xxxx/yyyy/dddd/1235.log
....
Wed Jul 22 16:01:00  ......
aaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbb
cccccccccccccccccccccc  directory::/xxxx/yyyy/dddd/1236.log
.....
Suppose this logfile has over 100K of lines, I want a Korn Shell program that can effectively scan thru the logfile and extract only:

Wed Jul 21 16:01:00  
directory:/xxxx/yyyy/dddd/1234.log
Wed Jul 22 02:00:03 ......
directory:/xxxx/yyyy/dddd/1235.log

Hints:  whenever  directory::/xxxx/yyyy/dddd/123?.log is displayed, there should always be
a date information (Wed Jul xxxxx)  before this line  (can be 3 , 4 line)


Note: Don't use simple code like below, it is too slow:

cat my.log  | while read line
do
    .................
done




Thank you

Answer : KSH: Extracting lines that have first Word in the predefined list

Anyway, the command proposed in http:#a33329967
will produce
Mon Jun 28 23:30:02 2010 '/ngnprod/archive/ngnprod_75018.arc'
Mon Jun 28 23:40:44 2010 '/ngnprod/archive/ngnprod_75019.arc'
Tue Jun 29 00:04:24 2010 '/ngnprod/archive/ngnprod_75021.arc'
Tue Jun 29 23:52:32 2010 '/ngnprod/archive/ngnprod_75206.arc'
Wed Jun 30 23:52:01 2010 '/ngnprod/archive/ngnprod_75391.arc'
Thu Jul  1 00:02:13 2010 '/ngnprod/archive/ngnprod_75392.arc'
Thu Jul  1 23:51:42 2010 '/ngnprod/archive/ngnprod_75553.arc'
Fri Jul  2 00:04:03 2010 '/ngnprod/archive/ngnprod_75554.arc'
Fri Jul  2 00:16:44 2010 '/ngnprod/archive/ngnprod_75555.arc'
Fri Jul  2 23:55:46 2010 '/ngnprod/archive/ngnprod_75721.arc'
Sat Jul  3 00:09:09 2010 '/ngnprod/archive/ngnprod_75722.arc'
Sat Jul  3 23:51:51 2010 '/ngnprod/archive/ngnprod_75888.arc'
Sun Jul  4 00:02:09 2010 '/ngnprod/archive/ngnprod_75889.arc'
when run on newalert.log.
Does that satisfy your requirements?
Random Solutions  
 
programming4us programming4us