in reply to Re: Extracting specific text info from the config file ouput
in thread Extracting specific text info from the config file ouput

I have a question which is an extension of the solution that I got for my previous problem. Extracting specific text info from the config file ouput
I have a string as specified in the code below. I need a mechanisam to extract the authentication information.
For me the right authentication information are
1. authentication open <and/or followed by something>
eg1: authentication open network-eap
eg2: authentication open
2. authentication shared <and/or followed by something>
That means I should pick only the ones that start with authentication. Not the one starting with 'aaa' in the example below.
Also when I am looping I should strip of the part which I extracted from the original string.

Could some one tell me how to do it?
my $str = "aaa authentication login\x0d\n ssid Rich\x0d\n authentic +ation open\x0d\n authentication shared \x0d\n"; my $authentication; while ($str =~/authentication (\S+)/){ $authentication = $authentiction. $1. " "; } # At the end of the while loop # $authentication should have the value # $authentication = open shared
Any input provided will be much appreciated! Thanks.