Re: Intent to package a Debian control file grepper
> Yes. It does not look approachable without a week of study. And according
It was easier than I thought, when I first picked it up. The key
seems to be that *most* of the features of sgrep are useless... this
was particularly clear from the 90 pages one of the XML books wasted
on it - most of which showed how you'd misparse files unless you used
exactly this one set of options :)
> Can you or someone else please show me, how my example queries would be done
> in sgrep? (I'm not interested in getting the same output format, but I want
I'm feeling lazy, so just to get you started, my most common query is
something like
sgrep -o '%r\n' 'DEB_PKG containing "sound"' /var/lib/dpkg/status | less
I'll throw in -i depending on how vague the keyword ("sound" in this
case) is. To get more specific fields (like your Package,Version
example) I'd just stick in an egrep "Package|Version" and not even
try to make sgrep do it, though I think it *can*...
Or if you just want to peek ahead in your mail spool without firing up
gnus, or something:
sgrep -o '%r' 'MAIL_MESS containing "someone"' /var/spool/mail/$USER | less
where someone is typically the username you're looking for...
In theory you can use sgrep to do narrower searches (like in that
case, I'd like to *print* MAIL_MESS, but only search MAIL_FROM) but I
haven't had a chance to work that out yet; any sgrep fans want to
suggest an approach?
_Mark_ <eichin@thok.org>
The Herd of Kittens
Debian Package Maintainer
Reply to: