Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.


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,


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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.