help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Breaking news: What did the IETF ever do for us? The *entire* list!


From: Pascal J. Bourguignon
Subject: Re: Breaking news: What did the IETF ever do for us? The *entire* list!
Date: Thu, 02 Apr 2015 05:27:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]