Home: Perl Programming Help: Regular Expressions:
Parsing Issue



krishna_sicsr
New User

Aug 18, 2009, 10:04 PM


Views: 6590
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
Speed
======================================
1 n1 OK UseBIOS <Factory-Default> -- --
2 n1 OK UseBIOS <Factory-Default> -- --
3 n1 OK UseBIOS <Factory-Default> -- --

Thanks, Krishna


spider
User


Aug 18, 2009, 11:45 PM


Views: 6587
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?


krishna_sicsr
New User

Aug 19, 2009, 12:03 AM


Views: 6585
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";
}


spider
User


Aug 19, 2009, 1:04 AM


Views: 6581
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 "-- --" ;