LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 08-08-2004, 02:35 AM   #1
eeyoree
Member
 
Registered: Aug 2004
Distribution: Slackware Ten
Posts: 34

Rep: Reputation: 15
how to find a specific file over several *.tgz files


let say i was in a directory with many .tgz files

now, i want to find a file, let say: 'libXm.so.2'
(i know the file were somewhere on that many .tgz files)

how to do that without open the file one by one?
 
Old 08-08-2004, 03:09 AM   #2
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
You're looking for something like whichpkg: http://www.linuxquestions.org/questi...light=whichpkg
 
Old 08-08-2004, 04:10 AM   #3
Ninaw
Member
 
Registered: Jun 2004
Location: QC, Philippines
Distribution: Ubuntu
Posts: 30

Rep: Reputation: 15
i've written a rather crude script to do just that, just modify it if you want
save it as tgzfind and make it executable (chmod u+x tgzfind)

Code:
#!/bin/bash

# tgzfind
# a very crude script to find a file from a dozen gz archives
# usage: tgzfind <directory> <search string>

if [ -d $1 ]; then
        cd $1
        for file in *gz; do
                hah=`tar -tvzf $file`
                echo $hah | grep --silent $2
                if [ $? -eq 0 ]; then
                        echo The file you are looking for is in $file
                fi
        done
fi
 
Old 08-08-2004, 04:15 AM   #4
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
You can try in the directory :

Code:
for file in `ls *.tgz`; do
    if tar tzvf $file | grep libXm.so.2; then
        echo "found in $file !"
    fi
done
[edit]
Ouch ! Ninaw was faster than me

Last edited by Cedrik; 08-08-2004 at 04:17 AM.
 
Old 08-08-2004, 04:34 AM   #5
Ninaw
Member
 
Registered: Jun 2004
Location: QC, Philippines
Distribution: Ubuntu
Posts: 30

Rep: Reputation: 15
Quote:
Originally posted by Cedrik
You can try in the directory :

Code:
for file in `ls *.tgz`; do
    if tar tzvf $file | grep libXm.so.2; then
        echo "found in $file !"
    fi
done
[edit]
Ouch ! Ninaw was faster than me
at least yours is shorter
 
Old 08-08-2004, 06:13 AM   #6
eeyoree
Member
 
Registered: Aug 2004
Distribution: Slackware Ten
Posts: 34

Original Poster
Rep: Reputation: 15
well, thank you everyone. i'll try them all
 
Old 08-09-2004, 12:37 AM   #7
Cerbere
Member
 
Registered: Dec 2002
Location: California
Distribution: Slackware & LFS
Posts: 799

Rep: Reputation: 33
If you're talking about original Slackware packages, then you can look through the MANIFEST.bz2 file in the /slackware directory of the install disc. It lists every file in every package.

Enjoy!
--- Cerbere
 
  


Reply



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
How to find files containing specific text? SurfTurtle Linux - Newbie 7 01-05-2008 05:57 AM
du on specific files from find command (use xargs?) fireman949 Linux - Software 2 07-10-2005 01:42 AM
Extract specific files from .tgz dgermann Linux - Newbie 6 08-25-2004 10:39 AM
Find files, directories that are own by specific user mikeshn Linux - General 2 02-12-2004 03:52 PM
How do I find a specific file? Itzac Linux - Newbie 6 02-05-2003 06:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:18 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration