Search the web
Sign In
New User? Sign Up
exim-users · Exim MTA
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
[Exim] Shell trick help   Message List  
Reply | Forward Message #69818 of 85778 |
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

--

## List details at http://www.exim.org/mailman/listinfo/exim-users Exim details
at http://www.exim.org/ ##




Tue Jul 27, 2004 8:26 pm

jpk28@...
Send Email Send Email

Forward
Message #69818 of 85778 |
Expand Messages Author Sort by Date

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...
Marc Perkel
marc@...
Send Email
Jul 27, 2004
8:21 pm

... I believe if you pipe the output (stream of IPs) to: xargs -n 1 COMMAND where COMMAND is your command that takes one IP as a parameter; you'll get what you...
Michael F. Sprague
mfs@...
Send Email
Jul 27, 2004
8:26 pm

... 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...
Julian King
jpk28@...
Send Email
Jul 27, 2004
8:28 pm

... What I often do is something like tail -f mainlog | sed '/.* H=[^[]*[[]\([^]]*\).*/!d;s//ping -c 1 \1/' | sh Tony. -- f.a.n.finch <dot@...>...
Tony Finch
dot@...
Send Email
Jul 28, 2004
9:07 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help