LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 10-14-2013, 02:05 AM   #16
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 1,805

Rep: Reputation: 808Reputation: 808Reputation: 808Reputation: 808Reputation: 808Reputation: 808Reputation: 808

Actually removing the sed part keeps it simpler and allows you to see the exact match(es), e.g.:

Code:
$ cat scriptname
#!/bin/sh
bzcat ~/MANIFEST.bz2 | grep -Fe "||   Package:" -e "$1" | grep -B1 -F "$1"
$ scriptname libmpfr
||   Package:  ./a/aaa_elflibs-14.0-i486-4.txz
-rwxr-xr-x root/root    299212 2012-06-29 11:59 usr/lib/libmpfr.so.1.2.2
--
||   Package:  ./l/mpfr-3.1.0-i486-1.txz
-rwxr-xr-x root/root       941 2012-03-23 21:57 usr/lib/libmpfr.la
-rwxr-xr-x root/root    369804 2012-03-23 21:57 usr/lib/libmpfr.so.4.1.0
-rw-r--r-- root/root    679242 2012-03-23 21:57 usr/lib/libmpfr.a
 
1 members found this post helpful.
Old 10-14-2013, 08:03 AM   #17
lems
Member
 
Registered: May 2004
Distribution: Slackware x86 (32 bit) & ARM
Posts: 114

Rep: Reputation: 33
Thanks a lot, ruario, I'm now using the following:

Code:
bzcat "$m" | grep -Fe "||   Package:" -e "$arg" | \
grep -B1 -F "$arg" | sed -n 's/||   Package:  //p' | \
grep -v \/source\/ | sed 's/^\.\///'
And get an output like this:

Code:
[a] aaa_elflibs-14.1-i486-2
[l] mpfr-3.1.2-i486-1

--or--

[a][*] aaa_elflibs-14.1-i486-2
[l] [ ] mpfr-3.1.2-i486-1

Last edited by lems; 10-14-2013 at 08:24 AM. Reason: Different output
 
Old 10-14-2013, 12:44 PM   #18
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 1,805

Rep: Reputation: 808Reputation: 808Reputation: 808Reputation: 808Reputation: 808Reputation: 808Reputation: 808
@lems: Just use one sed call, rather than two, e.g.:

Code:
sed -n 's,||   Package:  .*/\(.*\),\1,p'
EDIT: Also, you don't need to escape the slashes in your grep command. Something like this should work:

Code:
bzcat "$m" | grep -Fe "||   Package:" -e "$arg" | \
grep -FB1 "$arg" | sed -n 's,||   Package:  .*/\(.*\),\1,p' | \
grep -v /source/

Last edited by ruario; 10-14-2013 at 03:25 PM.
 
1 members found this post helpful.
Old 10-15-2013, 06:30 AM   #19
lems
Member
 
Registered: May 2004
Distribution: Slackware x86 (32 bit) & ARM
Posts: 114

Rep: Reputation: 33
Quote:
Originally Posted by ruario View Post
@lems: Just use one sed call, rather than two, e.g.:

Code:
sed -n 's,||   Package:  .*/\(.*\),\1,p'
EDIT: Also, you don't need to escape the slashes in your grep command. Something like this should work:

Code:
bzcat "$m" | grep -Fe "||   Package:" -e "$arg" | \
grep -FB1 "$arg" | sed -n 's,||   Package:  .*/\(.*\),\1,p' | \
grep -v /source/
Thanks for the hints, ruario. Though with the new sed command, it no longer preserves the series directory, which I found quite neat.

(On a sidenote, I've now implemented an OpenBSD installer style select/deselect mechanism, so one can select/deselect packages by typing a part of their name. This is not as convenient as a dialog interface, but a nice compromise.)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing Packages (bittornado) in Slackware take2hikes Slackware 17 05-13-2010 09:45 PM
Installing slackware extra packages Sargalus Linux - Software 1 03-02-2010 05:32 AM
Installing Packages on Slackware gtbutler Slackware 9 07-05-2007 11:58 AM
installing packages on slackware 11 bookie Linux - Newbie 13 04-15-2007 01:08 PM
installing/uninstalling slackware packages jaakkop Slackware 10 02-14-2005 09:11 PM


All times are GMT -5. The time now is 12:56 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration