This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: separating cygcheck -f package name from version
- From: Brian Inglis <Brian dot Inglis at SystematicSw dot ab dot ca>
- To: cygwin at cygwin dot com
- Date: Tue, 17 Jan 2017 12:46:51 -0700
- Subject: Re: separating cygcheck -f package name from version
- Authentication-results: sourceware.org; auth=none
- References: <0D835E9B9CD07F40A48423F80D3B5A704BBDBE05@USA7109MB022.na.xerox.net>
- Reply-to: Brian dot Inglis at SystematicSw dot ab dot ca
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