case insensitive pkg_info

It's actually a combination of several options, and of course the answer can be found in the pkg_info(1) manualpage.

Code:
smtp2:/home/peter/temp $ pkg_info -EIx geo
pecl-geoip-1.0.8
webalizer-geoip-2.23.8
The -x (or -X, it's merely an advanced regexp) takes care of the match making of the package name. By using the -E option it makes -I obsolete, but the reason I used it is force of habbit. -I takes care of only printing a one line package description instead of a full informative header, and it's an option (-Ix) I regularly use.

So finally the -E; it takes care of only showing matching package names, which is why you don't get any descriptions. As said, I could have used -Ex as well, this approach is simply force of habit on my end.
 
None of you gave me a proper reply, thus you instead answered me what I already knew and haven't asked. Let's attempt again. If you have any ports, then libiconv is something you all surely have.

Before even attempting to post execute this:
Code:
pkg_info -EX iconv
If you get output:
Code:
libiconv-1.14_1
Then Voila! Now you are eligible to proceed in helping.

We want the same output, but in a case insensitive way. This command must emit the same output, thus we'll have to have something modified: pkg_info -EX IcOnV. Note that IcOnV is an extended regex, so how do we pass/glue a modifier to it, which does case insensitive matching? re_format(7) describes how it works, but not how to pass a modifier.
 
Next time, try asking the question properly then. If no one answers it correctly, the question was wrong. Looking at the original question again, the intent wasn't clear at all.

Try pkg_info -EX [gG]eo and or pkg_info -EX [iI][cC][oO][nN][vV].

They're regular expressions, meaning: you have to write them as such.
 
If case-independent matching is specified, the effect is much as if all
case distinctions had vanished from the alphabet. When an alphabetic
that exists in multiple cases appears as an ordinary character outside a
bracket expression, it is effectively transformed into a bracket expres-
sion containing both cases, e.g. `x' becomes `[xX]'. When it appears
inside a bracket expression, all case counterparts of it are added to the
bracket expression, so that (e.g.) `[x]' becomes `[xX]' and `[^x]'
becomes `[^xX]'.
The point is, I want to pass one flag, instead of typing it the way you did, so RE a regex would do a translation for me.
 
That flag does not exist, and it will not be created (because pkg_* tools are on their way out). It has been implemented in PKGNG:

Code:
$ pkg info -ix iCoNv                                                                                                                               
libiconv-1.14_1
 
DutchDaemon said:
That flag does not exist, and it will not be created (because pkg_* tools are on their way out). It has been implemented in PKGNG:

Code:
$ pkg info -ix iCoNv                                                                                                                               
libiconv-1.14_1

You should look at it, the other way around. I mentioned RE_FORMAT(7).
Just imagine it as a lib used by grep, sed, pkg_* and possibly other bins.
RE Lib's rules are the one which should be same to all bins using it!
Let's take grep as example. It should be possible to enable case insensitive matching, even -i flag hasn't been passed, simply by issuing modifier as part of RE.
Then same RE behaves same for ALL bins (grep, sed, ... ). And yes, pkg_*
sed has an "I" modifier as part of RE which does exactly what I want.

Anyway, in a meantime, I've found it on my own:
Code:
pkg_glob :'(?i)geo'
It produces EXACTLY output which I need:
Code:
GeoIP-1.4.8_3

I'll shift scripts to PKGNG when they become part of base
 
Back
Top