Guest_imported
New member
- Jan 1, 1970
- 0
Hello,
Im working on a script that will
generate output based on a matching line
from a database. Im stuck!
Given the output from a shell script
10 200.171.14.12
I need to see if $2 matches an
ip from a known spammer in a text database.
IF the database contains a line like
200.171.14.12 REJECT
then print $0" ""BLACKLISTED"
should output
10 200.171.14.12 BLACKLISTED
If it doesnt match an ip in the database
Just Print $0
should output
10 200.171.14.12
Im not sure what to do, heres what
Ive tried.
#!/bin/sh
cat spam |awk 'BEGIN {
while( (getline listed < "/etc/postfix/access" > 0)
}
listed ~ $2 {$3="BLACKLISTED"}
print $1" "$2" "$3
close ("/etc/postfix/access"}'
Thanks in advance
Robert
Im working on a script that will
generate output based on a matching line
from a database. Im stuck!
Given the output from a shell script
10 200.171.14.12
I need to see if $2 matches an
ip from a known spammer in a text database.
IF the database contains a line like
200.171.14.12 REJECT
then print $0" ""BLACKLISTED"
should output
10 200.171.14.12 BLACKLISTED
If it doesnt match an ip in the database
Just Print $0
should output
10 200.171.14.12
Im not sure what to do, heres what
Ive tried.
#!/bin/sh
cat spam |awk 'BEGIN {
while( (getline listed < "/etc/postfix/access" > 0)
}
listed ~ $2 {$3="BLACKLISTED"}
print $1" "$2" "$3
close ("/etc/postfix/access"}'
Thanks in advance
Robert