From this input file I am trying to caputure the value QUEUE(#####) and RNAME(#####) from each line starts with AMQ8409 , I am able to get to the line and capture it but not sure how to split it or do any trick to only get the QUEUE and RNAME value , my output should look like :Timed out (reason: in while loop) ::expect_out(0,string) = > ::expect_out(1,string) = RF use CSWT#RF### dis qremote(MQSI.3PL846) RNAME1 : dis qremote(MQSI.3PL846) RNAME AMQ8409: Display Queue details.QUEUE(MQSI.3PL846)TYPE(QREMOTE)RNAME(MQ +SI.3PL846) No commands have a syntax error. AMQ8409: Display Queue details.QUEUE(MQSI.3PL944)TYPE(QREMOTE)RNAME(MQ +SI.3PL944) end2 : end
Here is what I have so far :QUEUE(MQSI.3PL846) ----- > RNAME(MQSI.3PL846) QUEUE(MQSI.3PL944) ------> RNAME(MQSI.3PL944)
However , this will catch the whole line.. Any advice is appreciated. Thanksopen (INPUT, "out") || die "couldn't open the file!"; open (OUTPUT, ">outF") || die "couldn't open the file!"; foreach $line (<INPUT>) { chomp $line; if ( $line =~ "AMQ8409" ) { print OUTPUT "$line\n"; } } close(OUTPUT); close(INPUT);
In reply to capturing words by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |