Re: Dunce awk question

2015-09-26 Thread Dan LaBell
On Sep 25, 2015, at 6:41 AM, 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: I've been doing something similar, except with sed #!/bin/mksh -p mbmon -c 1 | sed -n '2{ h s/, .*$// p } ' atactl wd0d

Re: Dunce awk question

2015-09-26 Thread William A. Mahaffey III
On 09/26/15 13:41, Dan LaBell wrote: On Sep 25, 2015, at 6:41 AM, 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: I've been doing something similar, except with sed #!/bin/mksh -p mbmon -c 1 | sed

Re: Dunce awk question

2015-09-25 Thread William A. Mahaffey III
H All good observations, especially the multiple pipes, I'll look into that. Thanks :-) On 09/25/15 11:13, Alistair Crooks wrote: Using your version string above, the following works for me: % echo 'Model: HGST HTS721010A9E630, Rev: JB0OA3J0, Serial #: JR10046P1D5UXN' | awk

Re: Dunce awk question

2015-09-25 Thread Alistair Crooks
Using your version string above, the following works for me: % echo 'Model: HGST HTS721010A9E630, Rev: JB0OA3J0, Serial #: JR10046P1D5UXN' | awk '/Model/ { print $3 }' HTS721010A9E630, Some rules I usually go by: 1. Piping through grep and awk is almost always wrong - awk has some fine regexps,

Re: Dunce awk question

2015-09-25 Thread Andy Ruhl
On Fri, Sep 25, 2015 at 8:34 AM, 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

Re: Dunce awk question

2015-09-25 Thread David
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 #:

Re: Dunce awk question

2015-09-25 Thread William A. Mahaffey III
On 09/25/15 11:18, David wrote: 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,