From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/32826 Path: main.gmane.org!not-for-mail From: Harry Putnam Newsgroups: gmane.emacs.gnus.general Subject: Re: Seeking suggestions for pet project Date: 08 Oct 2000 06:01:43 -0700 Sender: owner-ding@hpc.uh.edu Message-ID: References: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1035169043 21948 80.91.224.250 (21 Oct 2002 02:57:23 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 02:57:23 +0000 (UTC) Return-Path: Original-Received: from fisher.math.uh.edu (fisher.math.uh.edu [129.7.128.35]) by mailhost.sclp.com (Postfix) with ESMTP id 5B910D051E for ; Sun, 8 Oct 2000 09:06:34 -0400 (EDT) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by fisher.math.uh.edu (8.9.1/8.9.1) with ESMTP id IAC09524; Sun, 8 Oct 2000 08:06:18 -0500 (CDT) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Sun, 08 Oct 2000 08:05:37 -0500 (CDT) Original-Received: from mailhost.sclp.com (postfix@66-209.196.61.interliant.com [209.196.61.66] (may be forged)) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id IAA01856 for ; Sun, 8 Oct 2000 08:05:26 -0500 (CDT) Original-Received: from mail.networkone.net (mail.networkone.net [209.144.112.75]) by mailhost.sclp.com (Postfix) with SMTP id BE693D051E for ; Sun, 8 Oct 2000 09:05:45 -0400 (EDT) Original-Received: (qmail 10637 invoked from network); 8 Oct 2000 13:05:44 -0000 Original-Received: from adsl-116-86.ln.networkone.net (HELO reader.ptw.com) (209.144.116.86) by mail.networkone.net with SMTP; 8 Oct 2000 13:05:44 -0000 Original-Received: (from reader@localhost) by reader.ptw.com (8.9.3/8.9.3) id GAA21716; Sun, 8 Oct 2000 06:05:44 -0700 Original-To: ding@gnus.org In-Reply-To: Harry Putnam's message of "07 Oct 2000 07:09:47 -0700" Original-Lines: 59 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.5 Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:32826 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:32826 Harry Putnam 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"