Home: Perl Programming Help: Regular Expressions:
Parsing Issue

New User

Aug 18, 2009, 10:04 PM

Views: 6671
Parsing Issue

Hi Below is my output of one my command I have to parse the last value Allocated speed that is "-- --". I am not able to parse this value and store in one array to validate further. Please help me in this paring.

Port Network Name Status PXE MAC Address Allocated
1 n1 OK UseBIOS <Factory-Default> -- --
2 n1 OK UseBIOS <Factory-Default> -- --
3 n1 OK UseBIOS <Factory-Default> -- --

Thanks, Krishna


Aug 18, 2009, 11:45 PM

Views: 6668
Re: [krishna_sicsr] Parsing Issue

What have you tried? Show us some code.

What can you tell us about the input values?
How does the values look like when they are not -- --?
What about the other values? Are the MAC Address always in < >? If not how is the syntax when there are a adress spesified? Seperated by colon?
Can there be a space in any of the other values?

New User

Aug 19, 2009, 12:03 AM

Views: 6666
Re: [spider] Parsing Issue

Thanks I am done with this parsing my code is

$RET = "NEW ITEM -- --
OLD ITEM -- --";
@myarray = ($RET =~ /(--\s--)/g);
foreach $x1 (@myarray)
print"\n $x1";


Aug 19, 2009, 1:04 AM

Views: 6662
Re: [krishna_sicsr] Parsing Issue

So you did not wan't to get any speed, just the "-- --"?
If you want the excact string "-- --", why don't you just say:
print "-- --" ;