Autor: Julian King Data: Para: exim-users Asunto: Re: [Exim] Shell trick help
> > OK - I'm running tail on exim logs and extracting IP addresses that
> match a specific criteria. So I have a stream of raw IP addresses coming
> in that I want to pipe into a program that takes each IP address and
> runs a command with the IP address as the parameter.
>
> How do I do that?
If you mean what I think you mean then the shellscript answer would be
something like:
mangle_ip()
{
while read ip
do
my_command "$ip"
done
}
tail -f exim.log | sed -n "s/<stuff>/<otherstuff>/p" | mangle_ip
however you can probably do what you want with xargs instead, but it
depends what you want to do with each IP that you extract.
Julian
--
Julian King
Computer Officer, University of Cambridge, Unix Support