This is an extract from a large file. The lines that start with fc are ports on a fabric switch. In between each fc port there is information about the port.
fc2/12 is up
Port description is SEIEDISCOVER-3
Speed is 4 Gbps
fc2/13 is down (Administratively down)
fc2/14 is up
Port description is SEIEADB51
Speed is 4 Gbps
fc1/6 is down (Link failure or not-connected)
Port description is SEIDEVAS18
fc2/15 is up
Port description is UCS02-POD1-A 4/5
Speed is 8 Gbps
Belongs to port-channel 3
I want to be able to be able to print certain pieces of information for every fc port on the same line. So I would like the output to look like this. If a port is down then I want to skip to the next port that is up.
fc2/12 SEIEDISCOVER-3 4GB
fc2/14 SEIEADB51 4GB
fc2/15 UCS02-POD1-A 4/5 8GB port-channel 3
Is there a way to do this using awk? I appreciate any help on this.
---------- Post updated at 03:58 PM ---------- Previous update was at 02:59 PM ----------
I have figured this out from looking at other posts.
awk 'NF&&$1=RS$1' RS="fc"
get me everything in one line in between each fc and from this I am able filter out the info I need.