in reply to Splitting data into chunks!
So you've got a list of elements, each of which is either a port-channel line or a block of data, from which you want to extract the port list.
my @Filter = split /(port-channel \d\n)/, $Info; for (@Filter) { unless (/^port/) { # strip out the junk s/.*Ports://s; # Everything up to Ports:, even crossing line b +oundaries s/^\s+//m; # Leading spaces on lines s/\s.*//; # Everything from the first space to the end of + a line } print; }
|
|---|