X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:references:to:reply-to:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=kRSoywbis0ePkJ2U LtDD1MyF94u6CKOHkiIM224UK2aayxHrJlOyR2wz1vMLAq/CTlqIpuh60tVaTL7L 4JALvD01Vt3/tmQUFjLBq+YTvYBZP/lD3YqOY7e3+Suc23bwUuMWacn7nQOiZhK0 BK4w1xW2l7cYLx8saDQ9YooAyAw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:references:to:reply-to:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=HiCudWbvu6IptYBnSlKDai 7+1HQ=; b=onA7Zg50fWgiBExwynrKVpZYLYr1C8tBZjTyW//Hl9qRRQN/aUDTMX IjrX8GOWrhmQxBHI4puXkj+NLMcmlg0F3HkdAwbiaorWjbCXt/T7k80yEbvF/mIR HrWJ3zUJ9sy4ACP6kQYXVXI+PlZOYBs2g1j+XsQkUgubDZiUkM4UE= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.1 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=Hx-spam-relays-external:shaw.ca, H*r:shaw.ca, H*RU:shaw.ca, H*RU:64.59.134.13 X-HELO: smtp-out-no.shaw.ca X-Authority-Analysis: v=2.2 cv=BNTDlBYG c=1 sm=1 tr=0 a=WqCeCkldcEjBO3QZneQsCg==:117 a=WqCeCkldcEjBO3QZneQsCg==:17 a=IkcTkHD0fZMA:10 a=8AxlLl_AQzK2xpdmivwA:9 a=QEXdDO2ut3YA:10 Subject: Re: separating cygcheck -f package name from version References: <0D835E9B9CD07F40A48423F80D3B5A704BBDBE05 AT USA7109MB022 DOT na DOT xerox DOT net> To: cygwin AT cygwin DOT com Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca From: Brian Inglis Message-ID: <4ce98a93-0329-5061-09d7-7c6ef764b399@SystematicSw.ab.ca> Date: Tue, 17 Jan 2017 12:46:51 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <0D835E9B9CD07F40A48423F80D3B5A704BBDBE05@USA7109MB022.na.xerox.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfJs54pcnBXSwRuvul67bQXla1hjThlpUGV6/CzKVscpJcHoQ2akjfCedPcAvcz3qFYSBWBSq6uJuh8dnlsuErvoEePJW0pX/QPx4ogMrxH3j4kAq7uot g0kic9Xfd34pGQnbwfumjC8fphjSlL3m5CymVj+TaYO6mxpXny/BnChw0CCfL+1MYHhbTXhaokZYtw== X-IsSubscribed: yes On 2017-01-17 12:01, Nellis, Kenneth (Conduent) wrote: > I want to be able to extract a package's name from its version > information output by cygcheck -f. For many packages it is > easy: just strip off after the first hyphen; for example: > > $ cygcheck -f /usr/bin/find > findutils-4.6.0-1 > $ cygcheck -f /usr/bin/find | cut -d- -f1 > findutils > $ > > But, then there are cases where both the package name and the > version have multiple hyphens: > > $ cygcheck -f /usr/share/man/man3p/wcstoimax.3p > man-pages-posix-2013-a-1 > $ cygcheck -c man-pages-posix > Cygwin Package Information > Package Version Status > man-pages-posix 2013-a-1 OK > $ > > So, looking for ideas how best to do this. $ fgrep "$(cygcheck -f /usr/bin/find | sed 's/\r$//').tar." \ /etc/setup/installed.db | cut -d' ' -f1 findutils OR $ fgrep "$(cygcheck -f /usr/bin/find | d2u).tar." \ /etc/setup/installed.db | cut -d' ' -f1 findutils cygcheck -f outputs DOS lines with \r which need stripped as shown, using sed (Base), d2u, or your choice of available tool. -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada -- 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