Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like pipe the output of multiple commands to a single grep.

Example:

I'd like to combine these two lines:

smartctl -A /dev/sda | grep -e Reallocated_Event_Count -e Current_Pending_Sector
smartctl -A /dev/sdb | grep -e Reallocated_Event_Count -e Current_Pending_Sector

(Note that the only difference between these two lines is the disks are different: sda and sdb)

Any help is appreciated,

Thanks

share|improve this question
up vote 2 down vote accepted

You can try:

(smartctl -A /dev/sda ; smartctl -A /dev/sdb) | grep -e .... 
share|improve this answer
    
Excellent! Thank you! Brackets were the key elements that I was missing in everything that I tried! I'll accept your answer when it lets me :) – jtnire Jun 30 '12 at 15:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .