LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-03-2013, 05:19 PM   #1
MostViktorious
LQ Newbie
 
Registered: Oct 2010
Location: Toronto, Canada
Distribution: Arch Linux
Posts: 25

Rep: Reputation: 1
Looking for the most convenient grep command to list fields from two stdout entries


Hello, my goal is to be able to search an arbitrary amount of packages using
Code:
apt-cache show package1 package2
... and grep all of those entries with
Code:
| grep "Package\|Size"
for instance.

The current solution appears to be extremely inefficient and I would like to believe there's another method with manipulating cat and/or echo (I'm not too good with those yet.)

i.e

This produces exactly what I want:
Code:
apt-cache show gparted | grep "Package/|Size" && apt-cache show partitionmanager | grep "Package\|Size"
How do I reproduce this more efficiently?
 
Old 11-03-2013, 05:49 PM   #2
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
define "more efficiently"

your grep works just fine

Code:
apt-cache show gparted partitionmanager | grep "Package\|Size"
 
  


Reply

Tags
grep



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] grep with several fields in bash xeon123 Linux - Newbie 3 06-14-2011 10:37 AM
[SOLVED] Bash: How to grep stdout? ryan858 Programming 4 06-05-2010 10:17 AM
[SOLVED] redirecting STDOUT of previous command to STDIN of next command urban.yoga.journeys Linux - General 9 11-22-2009 03:16 AM
grep output on stdout and grep output to file don't match xnomad Linux - General 3 01-13-2007 04:56 AM
MySQL: List fields of a table mikeshn Programming 2 06-17-2003 12:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:54 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