Re: [OT] Filtern mehrer Zeilen...
On Tue, October 8, 2013 09:45, Boris Hoeffgen wrote:
> Hallo,
>
> ich bekomme von einem Kommando folgenden Output:
> ----------------------------------------------------------------------
> Device #0
> Device is a Hard drive
> State : Online
> --
> FRU : None
> S.M.A.R.T. : No
> S.M.A.R.T. warnings : 0
> Power State : Full rpm
> Supported Power States : Full rpm,Powered off
> --
> NCQ status : Enabled
> Device #1
> Device is a Hard drive
> State : Ready
> --
> FRU : None
> S.M.A.R.T. : No
> S.M.A.R.T. warnings : 400
> Power State : Full rpm
> Supported Power States : Full rpm,Powered off
>
> Diese Ausgabe möchte ich filtern, sodass nur noch
> State : Online
> S.M.A.R.T. warnings : 0
> State : Ready
> S.M.A.R.T. warnings : 400
>
> übrig bleibt und dann möchte ich die Werte der vier Zeilen auswerten.
> Wie mache ich das am besten?
Dann werfe ich mal noch awk in die Runde:
Befehl| awk '/^ *State|warnings/'
Grüße,
Christian
Reply to: