0

I want to do the following in the code below when I find these 2 strings, I want to get the IP of the same line that found these string (at least one of them) and throw the IP into a .txt file so that I can handle it in squid.conf . I'm trying to build a Splash Page in squid, and I only have the features of IPcop. Because of the code that I put up, it does not work because it compares any string, not the ones I need. Can anyone help?

#!/bin/sh

TAIL="/usr/bin/tail -f" 
SQUID="/var/log/squid/access.log"
PRINCIPAL1="http://cartilha.cert.br/"
PRINCIPAL2="cartilha.cert.br:443" 
LOG="/tmp/autenticados.txt"

$TAIL $SQUID | gawk '{if ($7 = $PRINCIPAL1 || $7 = $PRINCIPAL2) {print $3} }' >> $LOG
Jose Ricardo Bustos M.
  • 8,016
  • 6
  • 40
  • 62

1 Answers1

0

With the variable -v does not accept conditional. I do not think the topic is duplicated, because in the one they have passed, it has no conditional whatsoever.

I tried instead of just putting = = = = but doing so it does not give anything ..

The idea is simple, when accessing one of these links above I need to pick which IP accessed and play in a txt ... just that.