Bash script for server log (namely var/log/messages)
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Works perfectly, and stops me from banging my head against a wall.
Much appreciated!
Im gonna be cheeky now - can i just ask, what does the line 'n=split(i, s, SUBSEP)' do?
Thanks again.
multidimensional arrays are created using concatenation of string indices. therefore if want to store like array[ip,port] , awk will concat to one string using default separater "\034". however i just chose to use "@" for visibility. when we view the array, they are something like this
Code:
array[127.0.0.1@80]
and use ++ to increment the count for identical ip and port. As for the n=split(i, s, SUBSEP) line, i just want to get back the values of ip and port (stored in s), so i can print your desired output. hope you understand.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.