[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] scripts
- Subject: [ale] scripts
- From: chrish at ifsintl.com (Chris Hamilton)
- Date: Wed, 13 May 1998 10:33:39 -0400 (EDT)
> Would Perl be able to open a file, parse it for certain data (similar to gawk)
> and then pass the parsed data to an external program (gawk), a shell script or
> an executable? Hope this makes sense but I'm trying to avoid writing a C
> program as this takes longer and warp speed is not required.
>
> Thanks.
>
Hello there Lisa,
In regards to your question, my experience and advocacy of perl has lead
me to this answer: absoposolutely.
Here's an example:
text_file:
chrish:500:500:Chris Hamilton
mivey:501:501:Michael Ivey
gweez:-1:-1:Mr. Gweezlebur
perl script:
open(FH,'text_file')||die;
while(<FH>){
if(/^(\S+):\d+:\d+:/){
system("finger $1");
}
}
close(FH);
It's that simple. Perl's built in regular expression matching makes
parsing so very easy.
:q!
--
Christopher Hamilton Internal System Administrator
chrish at ifsintl.com IFS International, Inc.