Your example is EXACTLY what was happening to me! I would have expected grep
to dump the output in the order of the pattern file. Guess I assumed
incorrectly. 

I tried the "For/do" loops people sent me, but for some reason they didn't
run correctly. Most likely my fault.

I did use Rick Beebe's perl script and it worked PERFECTLY!! Big heaping
thanks Rick! Update will be posted very soon!!!

Thanks to all that offered help!

--Chris Santerre


> -----Original Message-----
> From: Chris Thielen [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 03, 2003 4:51 PM
> To: Spamassassin-Talk
> Subject: Re: [SAtalk] [RD] evil rules holdup. Stupid grep!
> 
> 
> Hi Chris:
> 
> I don't think I quite understand the problem.  I'll do my 
> best though: if
> you use a pattern file input to grep, no sorting is done.  Your output
> should be "sorted" exactly the same as the input is "sorted", only the
> output is filtered on the patterns in the file.
> eg:
> 
> input.txt:
> a
> b
> c
> d
> e
> f
> 
> patternfile.txt:
> e
> c
> a
> 
> $ cat input.txt | grep -f patternfile.txt
> a
> c
> e
> 
> Are your evilrules.cf are sorted alphabetically?
> 
> 
> 
> Perhaps this shell script (bash) will help you:
> 
> $ for i in `cat hitfreq.txt` ; do grep "$i" evilrules.cf ; done >>
> newevilrules.cf
> 
> HTH,
> Chris
> 
> 
> 
> Chris Santerre said:
> > I'm having some difficulties I need help with. I'd like to 
> punch the grep
> > command ;)
> >
> > Ok, the evilrules are done, except they are big! For just 
> 15 days I got
> > 1300
> > domains! This is even after removing the "www" duplicates!!!!
> >
> > So I ran a hitfreq script and have a file that lists 
> _in_descending_order_
> > the heavy hitters! I have the new evilrules.cf file as 
> well. What I want
> > to
> > do is sort the evilrules.cf file by the hitfreq file. So 
> people can just
> > take the heavy hitter evilrules if they want.
> >
> > Trouble is it won't simply dump the output, it always alpha sorts!
> >
> > I can do this:
> >
> > cat evilrules.cf | grep -C1 ruledecription >> newevilrules.cf
> >
> > And it will do it perfectly for that one rule, but I want the 1300+
> > hitfreq
> > sorted file to be the grep input. 1 description per line. So......:
> >
> > cat evilrules.cf | grep -C1 -f hitfreq.txt >> newevilrules.cf
> >
> > Which only outputs it in alpha!!!!! ARGH!!  Hellp 
> pleaze!!!! I tried the
> > -i
> > option to no avail. Anyone whip up a quick perl script for 
> me? that simply
> > says :
> >
> > while hitfreq
> >     grep -C1 $onestupidline >> newsortedevilrules.cf
> >     get next $onestupidline
> > do
> >
> > I've STFW and RTFM so much my head hurts.
> >
> > Whoever coded grep to autosort the output in alpha should 
> be flogged! :-)
> >
> > --Chris
> >
> > Chris Santerre
> > System Admin and SA Custom Rules Emporium keeper
> > http://www.merchantsoverseas.com/wwwroot/gorilla/sa_rules.htm
> > "A little nonsense now and then, is relished by the wisest 
> men." - Willy
> > Wonka
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: SF.net Giveback Program.
> > Does SourceForge.net help you be more productive?  Does it
> > help you create better code?   SHARE THE LOVE, and help us help
> > YOU!  Click Here: http://sourceforge.net/donate/
> > _______________________________________________
> > Spamassassin-talk mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/spamassassin-talk
> >
> >
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive?  Does it
> help you create better code?   SHARE THE LOVE, and help us help
> YOU!  Click Here: http://sourceforge.net/donate/
> _______________________________________________
> Spamassassin-talk mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/spamassassin-talk
> 


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to