I want to know how many user have visited google.com using my proxy with last 30 minutes.
awk -v bt=$(date "+%s" -d "30 minutes ago") '($1 > bt) && $4~/google.com/ {printf("%s|%s|%s|%s\n", strftime("%F %T",$1), $2 , $3, $4)} ' access.log
The logs look like this
2017-02-19 12:09:44|test@gmail.com|200|https://google.com/
2017-02-19 12:10:23|test@gmail.com|200|https://google.com/
Now i can easily count the number of records
awk -v bt=$(date "+%s" -d "30 minutes ago") '($1 > bt) && $4~/google.com/ {printf("%s|%s|%s|%s\n", strftime("%F %T",$1), $2 , $3, $4)} ' access.log | wc -l
Output is 2.
How can i modify the command to display only records with unique email.In the above case the output should be 1.