using System.Collections.Generic;
using System.Security.Cryptography;
public static void Main(string[] args)
var str = @"display service-port port 0/6/6 ont 0
Switch-Oriented Flow List
-----------------------------------------------------------------------------
INDEX VLAN VLAN PORT F/ S/ P VPI VCI FLOW FLOW RX TX STATE
-----------------------------------------------------------------------------
926 3205 common gpon 0/6 /6 0 325 vlan 3205 - - down
-----------------------------------------------------------------------------
Total : 1 (Up/Down : 0/1)
Note : F--Frame, S--Slot, P--Port,
VPI indicates ONT ID for PON, VCI indicates GEM index for GPON,
v/e--vlan/encap, pritag--priority-tagged,
ppp--pppoe, ip--ipoe, ip4--ipv4oe, ip6--ipv6oe, vxl--vxlan.
When FLOW TYPE is plist, the value of FLOW PARA is a byte in
hexadecimal format and indicates a priority list. Eight bits
of its binary value indicate priorities 0-7 from the least
significant bit to the most significant bit. Value 1 indicates
that the priority is used. For example, if FLOW PARA is 0x23 and
its binary format is 0010 0011, priorities 0, 1 and 5 are used";
var respostaServicePort = str.Split('\r', '\n').ToList();
Console.WriteLine(respostaServicePort.Exists(p => !p.ToUpperInvariant().Contains("error".ToUpperInvariant()) && !p.ToUpperInvariant().Contains("Failure".ToUpperInvariant())));
Console.WriteLine(respostaServicePort.Exists(p => p.ToUpperInvariant().Contains("vlan".ToUpperInvariant())));
var linhasServicePort = respostaServicePort.FindAll(p => p.ToUpperInvariant().Contains("vlan".ToUpperInvariant())).ToList();
foreach (var linha in linhasServicePort)
var campos = linha.Split(' ', ':', '\t');
var IdVlan = linha.ElementAtOrDefault(1);
if(linha.Trim().Replace(" ", String.Empty).ToUpperInvariant().Contains("gpon0/6/6".ToUpperInvariant()))
Console.WriteLine("undo service-port port 0/{onu.IdSlot}/{onu.IdPon} ont {onu.OntID}");