Okay not a programmer even to it says so above but did not find a newbe tag
Hello, I’m making my first small awk program and have a small problem with getting it to work as I want
I’m sorry if this question have been answered before(It probably have) but I tried to search but didn’t know
what to search for. But anyway, My program is connecting to my TCP port on my server and there listening
to log messages, this works quite ok but to get it “bullet proofed” I would need some help. My current program:
awk '$5~/Argument1/ { printf $9 } /Argument2/ {if ($10 == "something") print " Here is something"
if ($10 == "Something else") print " Here is something else"; if ($10 == "Even more stuff") print " Ooh look here" } ’
But to make it safer I would like the program to check that Argument1 and Argument 2 are on the same line
Now it sometimes cheats and read Argument2 from some other line. It is passing a lot of messages in the log and
Argument1 and Argument2 exist on other lines to but I’m only interested in them if they are on the same line.
Also the ifs that comes after Argument2 needs to be on the same line as Arbument1 and Argument2
This is probably not impossible, but to me it seams to be have been working on this 2 days now.
Hello, I’m making my first small awk program and have a small problem with getting it to work as I want
I’m sorry if this question have been answered before(It probably have) but I tried to search but didn’t know
what to search for. But anyway, My program is connecting to my TCP port on my server and there listening
to log messages, this works quite ok but to get it “bullet proofed” I would need some help. My current program:
awk '$5~/Argument1/ { printf $9 } /Argument2/ {if ($10 == "something") print " Here is something"
if ($10 == "Something else") print " Here is something else"; if ($10 == "Even more stuff") print " Ooh look here" } ’
But to make it safer I would like the program to check that Argument1 and Argument 2 are on the same line
Now it sometimes cheats and read Argument2 from some other line. It is passing a lot of messages in the log and
Argument1 and Argument2 exist on other lines to but I’m only interested in them if they are on the same line.
Also the ifs that comes after Argument2 needs to be on the same line as Arbument1 and Argument2
This is probably not impossible, but to me it seams to be have been working on this 2 days now.