stevenrh has asked for the wisdom of the Perl Monks concerning the following question:
Hello All,
I have a script that posts to a cgi, using a file i downloaded and awk'd as input. I currently would like to eliminate the wak step, and use oerl instead.
the file comes with three(3)fields:
IP:aa:hex_value
so I have this command:
grep ^192.168. file | awk F: '(print $1)' | sort > newfile
then run my LWP/POST script
the following code was an attempt to get that fist column, and use it as my input.....all with perl, not the shell.
#!/usr/bin/perl -w $|++; use HTTP::Request::Common; use LWP::UserAgent; $ua = LWP::UserAgent->new; my $file = 'fulldata'; open(FILE,"fulldata") || die "Could not open $file: $!"; while (<FILE>) { ($ip) = (split /:/) [0]; if (/^192.168./) { chomp; $ua->request (POST 'http://domain.org/subgmit.cgi', [ip => "$_", email => 'the_dude@dommain.net' ]); } last } close(INFO) or die "Error writing $file: $!";
Don't hold back, any (even brutal)advice is welcome...:() Thanks -stevenrh-
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: formatting text prior to using it it to post to cgi...
by ikegami (Patriarch) on Nov 17, 2004 at 22:44 UTC | |
Re: formatting text prior to using it it to post to cgi...
by jdporter (Paladin) on Nov 18, 2004 at 02:19 UTC |
Back to
Seekers of Perl Wisdom