From: "Pascal J. Bourguignon" <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Breaking news: What did the IETF ever do for us? The *entire* list!
Date: Thu, 02 Apr 2015 05:27:15 +0200 [thread overview]
Message-ID: <87k2xvus4s.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: 87619f8dmk.fsf@debian.uxu
Emanuel Berg <embe8573@student.uu.se> writes:
> The RFC memos and specifications - published by the
> semi-mythical IETF - are available in the Debian
> repositories as the non-free 'doc-rfc' metapackage.
>
> After installation ('sudo aptitude install doc-rfc')
> the files can be inspected in /usr/share/doc/RFC.
> They are all in .gz format, but one can unzip them
> with gunzip to get a neat 407M directory instead. Win!
> This makes it easier to manipulate the files with
> familiar and unfamiliar tools alike.
>
> Now it gets interesting. I wrote this zsh function to
> search the RFCs:
>
> search-rfc () {
> local search=$1
> files=("${(@f)$(grep -i $search -l /usr/share/doc/RFC/*/**.txt)}")
> for f in $files; do
> local data=`grep -c -H -i $search $f`
> local occs=${data##*:}
> local filename=${data%:*}
> echo $occs\\t$filename
> done | sort -n -r
> }
Wrong.
1- it should be written in emacs lisp.
2- you should search words using \< \> in regexp, to avoid finding
"isisCircLevelISPriority" when searching for "elisp".
Something like:
(defvar *rfc-base-directory* "/data/doc/rfc/")q
(defun search-rfc (word)
(interactive "sRFC Search Word: ")
(find-grep (format "find %S -name \\*.txt -exec grep -nHi %s {} \\;"
(shell-quote-argument *rfc-base-directory*)
(shell-quote-argument (concat "\\<" word "\\>")))))
--
__Pascal Bourguignon__ http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk
next prev parent reply other threads:[~2015-04-02 3:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-02 2:31 Breaking news: What did the IETF ever do for us? The *entire* list! Emanuel Berg
2015-04-02 2:59 ` Alexis
2015-04-02 7:11 ` tomas
2015-04-02 7:35 ` Alexis
2015-04-02 7:51 ` tomas
2015-04-02 3:27 ` Pascal J. Bourguignon [this message]
2015-04-02 22:56 ` Emanuel Berg
2015-04-03 1:42 ` Emanuel Berg
2015-04-03 1:33 ` Pascal J. Bourguignon
2015-04-04 1:30 ` Emanuel Berg
[not found] ` <mailman.3167.1427943592.31049.help-gnu-emacs@gnu.org>
2015-04-02 14:40 ` Udyant Wig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k2xvus4s.fsf@kuiper.lan.informatimago.com \
--to=pjb@informatimago.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).