Lan Barnes wrote:
On Thu, February 21, 2008 4:14 pm, SJS wrote:
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.
I am unfamiliar with strfile and randstr. I mentioned that this was in
conjunction with a Thunderbird plugin. The formatting of the sig file
follows the conventions of that plugin.
[snip]
For this sort of text processing, I'd probably reach for perl before
trying to build something out of grep.
I've done perl. Tcl was better.
What appeals to me the most about my gleanings from my lurking on Tcl
conversations is that with Tk, gui interfaces seem to be fairly easy to
construct on top of the Tcl programs.
--
Ralph
--------------------
KPLUG has regular contributors from all over the world. Even Kansas ;-)
--Lan Barnes
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg