This is what I got so far ..
I also am trying to work from a one-liner ...
What I am ultimately trying to do is search through a log file and sort out all the lines with a "status" string followed by a number 1 - 200. For example I want the string "status 1" to be dumped to status1.txt .. all the "status 2" strings I want dumped to a status2.txt and so forth.
anyway I'm trying to figure out how to combine the codes above to get what I want.. I know that I'm missing some stuff, but at this point I'm totally lost.
Thanks,
Code:
BEGIN{
error_no=0
while(1)
}
/status error_no / {
error_no++
if(error_no==200)
{
print "End Searching "
break
}
print $8
}
}
I also am trying to work from a one-liner ...
Code:
cat error.txt | grep status | awk '/status 1 /{a=$8;print a>"status1.txt"}'
What I am ultimately trying to do is search through a log file and sort out all the lines with a "status" string followed by a number 1 - 200. For example I want the string "status 1" to be dumped to status1.txt .. all the "status 2" strings I want dumped to a status2.txt and so forth.
anyway I'm trying to figure out how to combine the codes above to get what I want.. I know that I'm missing some stuff, but at this point I'm totally lost.
Thanks,