Wednesday, February 18, 2009

Nifty sed one liners for metastat


Was wanting to check for validation of root disks being mirrored and came across these one-liners:

1. metastat | sed -n '/Mirror/{n;p;n;p;n;p;n;p;}'

Output:

Submirror 0: d31
State: Okay
Submirror 1: d32
State: Okay
Submirror 0: d41
State: Okay
Submirror 1: d42
State: Okay
Submirror 0: d21
State: Okay
Submirror 1: d22
State: Okay
Submirror 0: d11
State: Okay
Submirror 1: d12
State: Okay
Submirror 0: d101
State: Okay
Submirror 1: d102
State: Okay


2. metastat | sed -n '/Mirror/{p;n;p;n;p;n;p;n;p;}'

d30: Mirror
Submirror 0: d31
State: Okay
Submirror 1: d32
State: Okay
d40: Mirror
Submirror 0: d41
State: Okay
Submirror 1: d42
State: Okay
d20: Mirror
Submirror 0: d21
State: Okay
Submirror 1: d22
State: Okay
d10: Mirror
Submirror 0: d11
State: Okay
Submirror 1: d12
State: Okay
d100: Mirror
Submirror 0: d101
State: Okay
Submirror 1: d102
State: Okay

Readers who read this page, also read:




Bookmark and Share My Zimbio http://www.wikio.com

0 comments: