Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.