dasdjasdjoasjdoasjdoa SYN dakspodkapsdka
asdasdasdasdasdasdasd SYN sdfsdfsdfsdfdf
shfishifhsdifhsidhfif fsdfsdfsdfsdfs
sdfsdfsdfsdsdfsdfsdff cercercercerce
sdasdajsdoajsodasodoo FIN dasdaskdpasdda
dkaspdkaskdpaskpaskdp FIN asdasdasdasdas
dasdjasdjoasjdoasjdoa SYN dakspodkapsdka
asdasdasdasdasdasdasd SYN sdfsdfsdfsdfdf
shfishifhsdifhsidhfif fsdfsdfsdfsdfs
sdfsdfsdfsdsdfsdfsdff cercercercerce
sdasdajsdoajsodasodoo FIN dasdaskdpasdda
dkaspdkaskdpaskpaskdp FIN asdasdasdasdas
The file is a huge log file with always 2 lines with SYN in exactly the same place one after the other, and also 2 FINS together. We have discovered that we are getting errors where 3 SYN lines are together, and I want to identify where these occurences are ie
dasdjasdjoasjdoasjdoa SYN dakspodkapsdka
asdasdasdasdasdasdasd SYN sdfsdfsdfsdfdf
asdasdasdasdasdasdasd SYN sdfsdfsdfsdfdf
shfishifhsdifhsidhfif fsdfsdfsdfsdfs
sdfsdfsdfsdsdfsdfsdff cercercercerce
sdasdajsdoajsodasodoo FIN dasdaskdpasdda
dkaspdkaskdpaskpaskdp FIN asdasdasdasdas
Ive looked at using grep to search for '3 SYNS' but i cant seem to get it to work.
Does anybody know how i can search for an occurrence of SYN in the same place , three lines running
grep will not do it, because you need to store values.
Try Perl.
This code should print output such as.
Line: 344 Content: dasdjasdjoasjdoasjdoa SYN dakspodkapsdka
Line: 345 Content:asdasdasdasdasdasdasd SYN sdfsdfsdfsdfdf
Line: 346 Content:asdasdasdasdasdasdasd SYN sdfsdfsdfsdfdf
Dude, you have 3 lines!
just a couple of comments on the code if you dont mind.
1) dont use html. (unless you want to display it on a web page. in that case i would opt to make it a cgi and be able to run it on demand via the web.
2) the code as is does not work. your missing a double quote and a semicolon.
3) you will only get lines 1,2,3 not 4,5,6 and so on down the file. just an FYI. remember your resetting $count almost everytime.
4) instead of $count == 3 its prolly better to do a catch and and say ($count => 3) you never know if there can be more then 3.
5) remove the first print. so only the >=3 SYN lines print.