Walt Mankowski on Wed, 9 Jun 1999 13:22:09 -0400 (EDT) |
How about... perl -e 'undef $/;$_ = <STDIN>;print "$&\n" if /\[$1[^\]]*\]/ms;' spectrophotometer <diary.txt Walt On Wed, Jun 09, 1999 at 09:57:17AM -0400, root wrote: > > > I enjoyed the recent flurry of response to someone's question about 'rm *'-- it > seemed to point out that there are lots of smart and experienced Unix people on > this list. I read the responses and learned some useful things that I might > have known had I ever actually been taught about Unix! > > I seem to be constantly trying new organizers, calendars, and ways of keeping > notes on my projects, but I generally wind up back at the point of keeping a > day by day text diary of my work. ASCII files seem so quick, simple, and > universal compared to GUI based approaches. > > The thing is, I'd like to mark entries that I put in my text based diary, so I > can scan for them by subject later, when I've forgotten when I worked on things. > > If my text file is: > > --------- > 6/9/99 > called Roy > [spectrophotometer.. > added timebased acquisition code to Mac program > replaced HiliteControl approach with gMode approach > ] > went for a jog > blah blah blah > > ------- > > The Question is: > How can I print the lines between the [] brackets, using the subject > ('spectrophotometer') to search? > > The grep is not so good, since the command > grep "spectrophotometer.." diary.txt -10 > > prints 20 lines with the file name at the beginning of each line and, anyway, > it would be much better if it would stop when it to the ']'. > > Is there some slick way to do this with awk or sed or some other utility? I'd > generally just like to see the text blocks in a text terminal window, but I > suppose I could pipe them into a project file, too, which would probably be > handy. > > Thanks in advance! > > Ben > > > -- > Benjamin Ward Dugan > President > Current Designs, Inc. > 3527 Hamilton Street > Philadelphia, PA 19104-2420 > ph: 215-387-5456 > fx: 215-386-4857 > > _______________________________________________ > Plug maillist - Plug@lists.nothinbut.net > http://lists.nothinbut.net/mail/listinfo/plug _______________________________________________ Plug maillist - Plug@lists.nothinbut.net http://lists.nothinbut.net/mail/listinfo/plug
|
|