delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/09/22/08:10:49

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.2 required=5.0 tests=AWL,BAYES_05,RCVD_NUMERIC_HELO,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_YG
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Oleksandr Gavenko <gavenko AT bifit DOT com DOT ua>
Subject: 'cygcheck -f' pattern syntax.
Date: Thu, 22 Sep 2011 15:10:05 +0300
Lines: 39
Message-ID: <j5f8io$2uq$1@dough.gmane.org>
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

   $ time cygcheck -f 'stdio.h'
real	0m1.016s
user	0m0.031s
sys	0m0.015s
   $ time cygcheck -f '*stdio.h'
   $ time cygcheck -f '*stdio.h'
   $ time cygcheck -f '*stdio.h'
   $ time cygcheck -f  /usr/include/stdio.h
cygwin-1.7.9-1

real	0m0.907s
user	0m0.015s
sys	0m0.031s

So 'cygcheck -f' does not allow 'glob' and 'regex'.

I write simple script that allow use regex:

   #!/bin/sh

   regex=$(echo "$1" | sed -e 's|\\|&&|g' -e 's|=|\\=|g')

   for file in /etc/setup/*.lst.gz; do
     name=${file#/etc/setup/}
     name=${name%.lst.gz}
     gzip -d -c $file | sed -n "\=$regex={s=^=$name: /=;p;}"
   done

But this script is extremely slow:

   $ time ./cygsearch.sh 'bin/emacs'
emacs: /usr/bin/emacs-nox.exe
emacs: /usr/bin/emacs.ico
emacs: /usr/bin/emacsclient.exe
emacs-X11: /usr/bin/emacs-X11.exe

real	0m38.797s
user	0m44.620s
sys	0m25.574s


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019