Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Nov 2002 14:08:11 -0800
From:      paul beard <paulbeard@mac.com>
To:        Scott Pilz <tech@tznet.com>, questions <questions@freebsd.org>
Subject:   Re: Syslog Piping
Message-ID:  <3DDAB64B.8050201@mac.com>
In-Reply-To: <20021119153526.M30438-100000@mail.tznet.com>
References:  <20021119153526.M30438-100000@mail.tznet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Scott Pilz wrote:

> 	In syslog, if you have:
>
> *.*			| /pipe.pl
>
> The output should be piped to pipe.pl - how, in perl, would you 
> go about
> capturing this output? I have tried everything I could think of. $1,
> ARGV[#], STDIN, while (<>) 


while (<>) {
code
}

should work. It's not a linuxism.

here's a sample:

[/home/paul]:: more test.pl
#!/usr/bin/env perl
while (<>) {
         print $_;
         }

Now just pipe something thru it:

[/home/paul]:: cat .signature | test.pl
Paul Beard / 8040 27th Ave NE / Seattle WA 98115 /
paulbeard [at] mac [ dot] com / 206 529 8400

weblog @ <http://paulbeard.no-ip.org/movabletype/>;

I'm rated PG-34!!

-- 
Paul Beard / 8040 27th Ave NE / Seattle WA 98115 /
paulbeard [at] mac [ dot] com / 206 529 8400

weblog @ <http://paulbeard.no-ip.org/movabletype/>;

I'm rated PG-34!!


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3DDAB64B.8050201>