freenode/#devuan/ Friday, 2019-05-31

Digitis there a way to get "apt search" output only 1 line per result?  or a way to get "apt-cache search" to show version numbers (still 1 line per result)?02:15
Digiti mean, without elaborate awking/sedditing/etc02:15
gnarfacejust pipe the output to less02:17
gnarfaceapt-cache search . |less02:17
gnarfacethen you can use the basic keyboard navigation at least02:18
Digituhh, nope.  doesnt do what i'm looking for at all.  worsens.02:18
gnarfacei know it doesn't do what you asked for, but it was the closest you're gonna get without learning anything02:19
gnarfacefyi "apt-cache search" does support some regexp syntax though, more than just basic wildcards02:19
Digite.g. search result would show "packagename packageversion"02:20
gnarfaceyou want "apt-cache show [package name]"02:20
gnarfacethe version will be in the output02:20
Digiti'll probably just end up sedditing my way to 1 line output.02:21
gnarfacecombining search and show in the way you suggest, would as far as i know require "elaborate awking/sedditing/etc"02:21
gnarfacemaybe try aptitude?  some people like it more02:21
gnarfaceit might include versions in the output, i'm not sure02:22
Digityeah, gnarface that's again far from what i want.  XD  your suggestions are adding lines, not removing them.  seems a simple requirement i would have thought would be more popularly sought.  search output with just "packagename packageversion"02:22
gnarfaceoh you can search with the package version02:22
gnarfaceit just isn't shown in the output of search02:23
Digitneeded for inclusion in scripts.  idk aptitude well... it's all tui, no?02:23
gnarfacebut the search regexp itself does actually search against the whole output of all the package headers and such too02:23
gnarfaceso you can definitely search by package and version if you know the package header format and regexp02:23
gnarfacefor most packages, typically they don't store more than one version in the repos for an extended period of time though, so there's a limit to the usefulness of that02:24
gnarface"dpkg -l" will list versions of packages too, but only if they're already installed02:29
* Digit nods02:29
gnarfacehmmm.  ack, i may be wrong that the Version tag is even searched by apt-cache search....02:30
Jjp137Digit, try: dpkg-query --show package02:32
Jjp137you can use --showformat to control the output; refer to the man page, as always :)02:32
gnarfaceas for aptitude, i don't know if there's a way to call it non-interactively.  i just assumed there would be but it would not be the default.02:32
Digithrm.  dpkg-query --show teeworlds (the package i'm testing on) gives: dpkg-query: no packages found matching teeworlds.   that another case of only installed packages?02:34
gnarfacei don't actually know for sure but i assume so02:34
gnarfacedpkg is typically for direct package manipulation02:35
gnarfaceapt* is what adds repository support02:35
Digitcoulda also been complications from the complexity of my system.02:35
Jjp137oh nah I didn't consider that part, oops02:35
gnarfacei'm guessing there will have to be two calls here, one to "apt-cache search" to get a list of package names, and another to "apt-cache show", "apt-cache showpkg", or "apt-cache showsrc"02:37
gnarface(to grep for versions)02:37
gnarfacemore fields than just the package name are searched by "apt-cache search" but "Version: " doesn't appear to be one of them.  i'm having trouble isolating exactly which by testing02:38
gnarfacemaybe "Provides: " is searched02:40
gnarfacein addition to package name and description02:40
gnarfaceat some point i must have caught a version number in there and thought "Version: " was included, sorry02:41
gnarfacei'm not even sure Description is searched actually now with amprolla02:42
gnarfacei recall someone complaining about that before and now i'm seeing it02:42
Jjp137the short description (the one-liner) would be02:42
Jjp137the long description...uh yea it disappears if the package came from Debian02:42
* Digit elaborated: apt-cache show bc | cut -d" " -f2 | head -n 2 | paste -d " " - -02:43
Digit:D02:43
Digittho, that still needs work for more elaborate multi result output.02:43
gnarfaceapt-cache show bc|grep ^Version02:44
gnarface?02:44
gnarface(grep has similar regexp syntax to apt-cache search)02:45
Digitmm, yeah, i should grep wiser02:45
gnarfacei think you can trust the field names to all be labeled like "Fieldname: "02:46
gnarfacei don't know if you can trust them to always be in the same order02:46
gnarfaceor even to all be present every time02:46
gnarfacebut they should always start on their own line02:47
gnarfaceso you should be able to grep for "^Fieldname: "02:47
XenguyDigit: Reading quickly, but this sounds like a grep exercise, and I'm still not clear on what your actual requirement is, besides '1 line', of 'something'02:55
XenguyOh, gnarface has it sorted, so ignore my comment02:56
Digitpackage search output of "packagename package version".  yeah.  well, had hoped i could skip the text manipulation exersize i'm going through.  now i'm going through it, it doesnt hurt so much.  n_n02:56
Xenguyapt-cache show grep |grep version02:58
Xenguy= )02:58
Digits/package version/packageversion/   meh, whatever.  u get what i mean.  like "bc 1.06.95-9+b3" or "teeworlds 0.6.5+dfsg-1~deb9u1", but want it (and am working on) getting it so it works for multiple results n partial package names in the search.02:59
XenguyShould be:  apt-cache show grep |grep -i version02:59
DigitXenguy: that doesnt have the package name.  we're past that.03:00
Xenguypicky picky03:00
Digithehe03:00
Xenguy; -)03:00
Digitapt-cache show bc | cut -d" " -f2 | head -n 2 | paste -d " "  - -   ...&...  apt-cache show teeworlds | egrep '^Version|^Package' | paste -d " "  - - |  sed 's/Package: //g' | sed 's/Version: //g'   ... are two early versions inadequate for multiple results.  gonna make one from "apt search" output that should do the job.   ... might take a break first.03:01
Xenguyweeeeeeee, pipe city!03:01
Digitn_n03:01
XenguyTime to play some golf03:02
XenguyBut whatever works, right?03:02
Digitor from "apt-cache search -f" output03:06
Jjp137do note that apt, as opposed to related commands like apt-get or apt-cache, is more of an end-user tool and can change behavior between versions (see the bottom of apt(8) for details)03:06
Jjp137so I would just use apt-cache for this probably03:06
Digityep yep yep.  *nods*  :)03:06
XenguyJjp137: I've been trying apt out here and there, and it seems to work quite nicely...03:07
Jjp137yea for interactive use it's fine03:07
XenguyI also read that it is more or less compatible/interchangeable with apt-get, so that is a bonus IMHO03:07
Jjp137but for scripts, prefer apt-get, apt-cache, etc.03:08
XenguyJjp137: Yeah, they say don't script it03:08
XenguyExactly03:08
Digitooh!  my prior version, all i need to do to make it work is s/apt-cache show/apt-cache search -f/.  :D  pleasant.03:09
XenguyGolf!03:10
XenguyWell done03:10
Digitn_n  thnx for putting up with me.  thnx for the suggestions n help, all.  :)03:12
XenguyI'm tempted to engage the exercise myself, but, on 2nd thought, nah ; -)03:12
XenguyGlad to have you here03:12
Digitwell, in my script, apt-cache search -f "$argv" | egrep '^Version|^Package' | paste -d " "  - - |  sed 's/Package: //g' | sed 's/Version: //g' is not as simple&pretty as just apt-cache search "$argv", but it's nice to get consistent output with name and version, without bloating output to multi-line per package.  :)   nnnnnice.  :)03:16
Digit(that $argv's fish, change to whatever that is for your bash, i forget... $1 or something?)03:17
* Xenguy cheats: apt-cache show grep |grep Package && apt-cache show grep |grep Version03:18
* Digit tries that with teeworlds package, and tries it with s/show/search -f/, sticks to what he has03:20
Xenguy$ apt-cache show teeworlds |grep Package && apt-cache show grep |grep Version03:24
XenguyPackage: teeworlds03:24
Xenguy^^ Scratch that03:24
Xenguy$ apt-cache show teeworlds |grep Package && apt-cache show grep |grep Version03:24
XenguyPackage: teeworlds03:24
XenguyVersion: 2.27-203:24
XenguyThen I'd just use a text editor macro to massage the output03:25
XenguyBut that's a quick and dirty approach03:25
XenguyIf you've got a better solution, then go for it of course03:25
Digityeah, already pasted it in here a couple times.  ;D03:31
XenguyWell that's what I meant of course03:34
Xenguy"There's more than one way to skin a..."  Er, n/m03:34
Digitmore than one way to egrep ;D03:35
XenguyAs the Perl Mongers used to say (and perhaps still do): TMTOWTDI (There's More Than One Way To Do It!)03:39
Xenguy(And with Perl, that was most certainly true)03:39
Xenguy(tim-toady)03:51
Venkerhi people09:38
gnarfaceyo09:39
HundHey16:22

Generated by irclog2html.py 2.17.0 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!