[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-team] Re: perl et fgrep
On Fri, Aug 27, 1999 at 10:27:14AM +0200, vranckx wrote:
> Cette question est peut-etre evidente : existe-t-il une fonction dans
> perl
> equivalente a fgrep (fixed-string). Je dois faire des recherches de et
> dans des strings contenant des $,@... et je ne veux qu'il soit
> interpretes.
euh... je ne vois pas ce que tu veux dire...
#!/usr/bin/perl
for ($i=1; $i <= $#ARGV; $i++)
{
$filename = $ARGV[$i];
open(F, "<".$filename) or die "Cannot open $filename";
@matches = grep {/[\$@]/} <F>;
close(F);
chomp(@matches); # virer les \n à la fin des lignes
if ($#matches >= 0)
{
print "$f: (" . $#matches . " matches)\n";
foreach (@matches) {print " $_\n";}
}
else
{
print "$f: no matches\n";
}
}
Un truc de ce genre là ?
Explique ton problème, je te donnerai une soluce ;)
/me perl-guru ;)))
--
-o) Pascal Bleser | Those who do not understand
/\\ C++/UNIX Development | Unix are condemned to reinvent
_\_v ATOS Payment Systems | it, poorly.
Aachen, Germany | --Henry Spencer {fortune}
<pbleser@atos-group.com>------------------<guru@linuxbe.org>
---------
Visit the Linux Supertore Online: http://www.redcorp.com !
If you want to be deleted from the list, send a mail to
majordomo@rtfm.be with "unsubscribe linux-team" in the body.