Redirect hdparm output to grep?

Alexander Griesser alexander.griesser at lkh-vil.or.at
Wed May 14 06:31:22 UTC 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alan Dayley wrote:
| I want to then parse the output of this command to determine if a
| partition was found or not.  My proposed command is:
|
| /bin/hdparm -z /dev/sda | grep -c sda1
|
| This should return a count of the string "sda1" in the output from
| hdparm,  But, it does not work.  First it appears that most of the
| hdparm output goes to stderr instead of stdout.  Secondly the various
| piping combinations I have tried don't produce output to grep.

Have you tried grepping stderr by now?

e.g. /bin/hdparm -z /dev/sda 2>&1 | grep -c sda1

ciao,
- --
Alexander Griesser (Netzwerkadministration)
E-Mail: alexander.griesser at lkh-vil.or.at | Web: http://www.lkh-vil.or.at
KABEG LKH Villach | Nikolaigasse 43 | 9500 Villach
Tel.:   +43 4242 208 3061 | Fax.:   +43 4242 971 3061
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIKoc666HVD6KUm1oRAuYMAJ9RVFx7FPW4rrnVfzbVtB7B42AFhACeJBu3
ieIcPlN8BQ7Lfugu4hu0+j4=
=9eu0
-----END PGP SIGNATURE-----



More information about the busybox mailing list