Apologize if this is doesn't come under this group. I have a small script to find out users who last logged in to check there mail. (Tru 64 4.0, Netscape mail 3.6)
----->
cat $1|awk -F: '$2=="SMTP-Accept" && $5~/@maildomain/ {s=$5;u[s]++;las=substr($1)} END {for (i in u) {print i,u[i],las}}'|sort>>/tmp/mailusage.list
<-----
It works when I run it with just one file (e.g script log20011107). But bombs out when I give command: script log*. It checks the first file only. I tried to put another for loop for the script, but no good. Any suggestions. TIA, Ciao,
You mention that you already tried looping it...
It didn't work when you did something like this?:
for each in `ls -1 log*`
do
cat $each|awk -F: '$2=="SMTP-Accept" && $5~/@maildomain/ {s=$5;u[s]++;las=substr($1)} END {for (i in u) {print i,u[i],las}}'|sort>>/tmp/mailusage.list
done
What happened when you tried that?
LivinFree,
This what I just did, and it worked:
----
cd /netscape/logsdir
>/tmp/mailus.list
cat Maillogs*|awk -F: '$2=="SMTP-Accept" && $5~/@maildomain/{s=$5;u[s]++;las=substr($1,1,8)} END {for (i in u) {print
i,u[i],las}}'|sort>>/tmp/mailusage.list
join -a 1 -e NA -o 1.1 2.3 2.2 /tmp/users.list /tmp/mailusage.list>/tmp/totalusage.list
-----
Initially, I did this and used to give me errors: can not open log-date-file. It would list all the files saying it can't open them
for i in `ls /netscape/logsir/`
cat $1|awk -F: '$2=="SMTP-Accept" && $5~/@maildomain/{s=$5;u[s]++;las=substr($1,1,8)} END {for (i in u) {print
i,u[i],las}}'|sort>>/tmp/mailusage.list
join -a 1 -e NA -o 1.1 2.3 2.2 /tmp/users.list
---- What did I do wrong then? Well thanks, Ciao