in reply to Search for a string in a file and get the string in the next line
while($line = <DATA>) { if ($line =~ m/PSP-Ri/) { $line = <DATA>; print "Codec = $1\npktSize = $2\nattrib = $3\n\n" if $line =~ m/ +Codec\s(\S+).+pktSize\s(\d+)\sattrib\s(\S+)/; } } __DATA__ 125 09082010 093627.953624:1.01.00.27144.Info .CC: *GCID:0x00000013--I +ngress PSP-Ri 206 09082010 093627.953812:1.01.00.27145.Info .CC: *GCID:0x00000013--C +odec G711 (0x1) pktSize 20 attrib 0x1c00
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Search for a string in a file and get the string in the next line
by Kadam (Initiate) on Oct 11, 2010 at 12:26 UTC |