NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Dunce awk question



On 2015-09-25 11:41, William A. Mahaffey III wrote:

I am trying to use awk & grep to fashion a command to print out HDD
temps, along w/ some identifying info:

[wam@4256EE1, ~, 10:41:29am] 418 % sudo atactl wd0 identify | grep Model
Model: HGST HTS721010A9E630, Rev: JB0OA3J0, Serial #: JR10046P1D5UXN
[wam@4256EE1, ~, 10:41:31am] 419 % sudo atactl wd0 identify | grep
Model | awk '{printf $3 " "}' -
[wam@4256EE1, ~, 10:41:32am] 420 % uname -a
NetBSD 4256EE1.CFD.COM 6.1.5 NetBSD 6.1.5 (GENERIC) amd64
[wam@4256EE1, ~, 10:41:34am] 421 %

I am only *weakly* familiar w/ GNU awk, where the above works. What am
I missing here, I expected the above to print out the model # of the
HDD. Please apply the clue-bat generously :-) ....

You almost certainly don't need grep when awk is involved:

echo 'Model: HGST HTS721010A9E630, Rev: JB0OA3J0, Serial #: JR10046P1D5UXN' | awk '/Model/{print $3}'

seems to work for me...

--
david%chromiq.org@localhost


Home | Main Index | Thread Index | Old Index