begin  quoting Ralph Shumaker as of Thu, Feb 21, 2008 at 02:42:05PM -0800:
> My sig file grows larger.  And every once in a while, I want to be 
> selective about which sigs are selected by my random sig selector (a 
> plugin for thunderbird).
> 
> I thought about making a script that moves the sig file out of the way, 
> and greps certain lines from the main sig file (now a different name), 
> and dumps them into a sig file of the original name.  But my problem is 
> that I need grep to cough up everything between the two "%" delimiters, 
> not just the matching line.  And further, if more than one sig matches, 
> I don't want two successive delimiter lines.  And finally, I don't want 
> a delimiter line at the beginning or end of the resulting file.
> 
> I don't have much experience with such things outside of DOS batch 
> files, and even that was long ago.  But I'm thinking I may need to use 
> grep -n STRING to identify the line numbers of the matches, and grep -n 
> ^%$ to identify the delimiter lines.  But then it would be a matter of 
> telling sed to grab the appropriate line numbers.  But how do I get the 
> script to calculate which line numbers?

Do you run your sigs thru strfile first?

Hm... I can't find the randstr example on my system, despite the
manpages claiming that it's part of this distribution. Nor do I have
the strfile.h header, contrary to what I would expect.

[snip]

For this sort of text processing, I'd probably reach for perl before
trying to build something out of grep.

-- 
What sounds interesting is an strfile dat file
And a named pipe fed by a randstr derivative.
Stewart Stremler

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to