Gnus development mailing list
 help / color / mirror / Atom feed
From: Harry Putnam <reader@newsguy.com>
Subject: Re: Seeking suggestions for pet project
Date: 08 Oct 2000 06:01:43 -0700	[thread overview]
Message-ID: <m2snq78p1k.fsf@pgnus-5.8.8-cvs.now.playing> (raw)
In-Reply-To: Harry Putnam's message of "07 Oct 2000 07:09:47 -0700"

Harry Putnam <reader@newsguy.com> writes:

> [cc'ed to ding list]
> 
> Kai,
> I've written a shell/awk script search engine that one might call a
> targetted multi grep type search.  As you know I'm not very experience

Apparently I left out the stripped down script:

find $4 -type f -name '[0-9]*'|xargs  awk '{ # set values from the command line
 
     RE1_p = '"\"$1\""' 
     RE2_p = '"\"$2\""' 
     RE3_p = '"\"$3\""' 
   }

   {
      if (FNR == 1) {
          in_header  = 1
          in_matched = 0
          RE1_l  = ""
          RE2_l  = ""
          RE3_l  = ""
      } else if (in_header && /^$/) {
          in_header  = 0
          if (RE1_l && RE2_l) {
              in_matched = 1
          }
      }
      if (in_header) {  # in header section
          if ($0 ~ RE1_p) {
              RE1_l = $0
          } else if ($0 ~ RE2_p) {
              RE2_l = $0
          }
      } else if (in_matched) {  # in body of matched message
          if ($0 ~ RE3_p) {
              if (! RE3_l) {
                        filename2=FILENAME      
                                sub(/^.*\//,"",filename2)
                                    print "-- \n" FILENAME
                  print filename2"|" RE1_l
                  print filename2"|" RE2_l
                        }
              RE3_l = $0
              print filename2"|"FNR"|" RE3_l
          }
      } else {  # in body of unmatched message
            nextfile  # GNU awk extension to skip to next file
      }
  }'
#    END {
#    print "RE1="RE1_p "\nRE2="RE2_p"\nRE3="RE3_p
#}'
echo "RE1=$1"
echo "RE2=$2"
echo "RE3=$3"




  reply	other threads:[~2000-10-08 13:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-07 14:09 Harry Putnam
2000-10-08 13:01 ` Harry Putnam [this message]
2000-10-08 21:36 ` Kai Großjohann
2000-10-09  2:20   ` Harry Putnam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2snq78p1k.fsf@pgnus-5.8.8-cvs.now.playing \
    --to=reader@newsguy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).