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

Re: [OT] Filtern mehrer Zeilen...



hi,

Am 8. Oktober 2013 09:45 schrieb Boris Hoeffgen <borish@hjdt.de>:
> 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?

nach [1]  <Kommando> | grep -B 1 "S.M.A.R.T. warnings"

Gruß,
Björn

[1]: http://unixhelp.ed.ac.uk/CGI/man-cgi?grep


Reply to: