LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-28-2013, 07:29 AM   #1
smilemukul
Member
 
Registered: Jun 2009
Distribution: Redhat,CentOS,Ubuntu,Puppet
Posts: 292

Rep: Reputation: 34
How to query multiple packages from a file


Hi,

I am writing a bash script where I want to query multiple packages which are kept in a file (/opt/packages) & i am using the command as,

rpm -qa --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n"

& if the packages where not found which was listed in the file then install the packages through yum install.
 
Old 07-28-2013, 09:53 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,921

Rep: Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690
Quote:
Originally Posted by smilemukul View Post
Hi,
I am writing a bash script where I want to query multiple packages which are kept in a file (/opt/packages) & i am using the command as,

rpm -qa --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n"

& if the packages where not found which was listed in the file then install the packages through yum install.
Ok...so is there a question/problem somewhere in there???

If you're having a problem with your script, post it and the error(s) you're getting. Otherwise, check out the bash scripting tutorial you can find in my post signature, which covers loops and reading input files.
 
Old 07-28-2013, 12:45 PM   #3
smilemukul
Member
 
Registered: Jun 2009
Distribution: Redhat,CentOS,Ubuntu,Puppet
Posts: 292

Original Poster
Rep: Reputation: 34
Its resolved through a script as,

for pkg in `cat file`; do

rpm -qa --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n" "$file"
yum install $file

done
 
  


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
[SOLVED] SQL query: multiple combinations krilen Programming 5 07-22-2011 01:45 PM
Query multiple packages john_h_grubb Linux - Newbie 2 03-29-2008 05:44 AM
slackware packages query matters Slackware 2 03-12-2008 12:02 AM
Partitioning for Multiple Linux Distributions Query Tony Bradley Linux - Desktop 1 01-18-2007 08:45 AM
mod_auth_mysql query to multiple database loewen Linux - Newbie 2 11-21-2006 11:04 AM


All times are GMT -5. The time now is 10:19 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration