Hey scripters
this is the first time i use AWK
i looked for a solution to find out who is "out" at the moment
i get a log in this format
Code:
time (user) OUT: "DOORS" mail1 [ttt]
time (user) OUT: "DOORS" mail2 [ttt]
time (user) IN: "DOORS" mail2 [ttt]
time (user) OUT: "DOORS" mail2 [ttt]
time (user) OUT: "DOORS" mail3 [ttt]
time (user) OUT: "DOORS" mail4 [ttt]
time (user) IN: "DOORS" mail3 [ttt]
time (user) IN: "DOORS" mail4 [ttt]
if i analyze this log manually, i can find out that mail1 and mail2 are out at the moment
with awk command
$3=="IN:" {print $0} and
$3=="OUT:" {print $0} i have split the log into two files "in.txt" and "out.txt" with
content of in.txt
Code:
time (user) IN: "DOORS" mail2 [ttt]
time (user) IN: "DOORS" mail3 [ttt]
time (user) IN: "DOORS" mail4 [ttt]
content of out.txt
Code:
time (user) OUT: "DOORS" mail1 [ttt]
time (user) OUT: "DOORS" mail2 [ttt]
time (user) OUT: "DOORS" mail2 [ttt]
time (user) OUT: "DOORS" mail3 [ttt]
time (user) OUT: "DOORS" mail4 [ttt]
now i need help by comparing these two files who is out at the moment.
my wanted output is wo is out at the moment
Code:
time (user) OUT: "DOORS" mail1 [ttt]
time (user) OUT: "DOORS" mail2 [ttt]
any help is appreciated