ultibuzz has asked for the wisdom of the Perl Monks concerning the following question:
i tryd somthing with an foreach loop but i cant get it to work as u see above i specived an element of the arrys and it works fine, but i need to count trough all elements ;D UPDATE: here is a line from a file 120227714;520226667;03015;03200;0000031685; this string 03015;03200 need to be filterd and if its ok then the hole line needs to go to a new file#!/usr/bin/perl $infile = @ARGV[0]; $outfile = "OK.txt"; $outfile2 = "ERROR.txt"; @Filter = ('01005;01000','01005;01001','01005;01002','01005;01003'); $zaehler = 0; open(INFILE, "< $infile") or die "\nDatei $infile konnte nicht geoeffnet werden\n"; open(OUTFILE, "> $outfile") or die "\nDatei $outfile konnte nicht geoeffnet werden\n"; open(OUTFILE2, "> $outfile2") or die "\nDatei $outfile2 konnte nicht geoeffnet werden\n"; while (<INFILE>) { print OUTFILE if /@Filter[0]/; } close(INFILE); close(OUTFILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Filter script with pattern and an array
by reneeb (Chaplain) on Oct 03, 2005 at 11:37 UTC | |
by reneeb (Chaplain) on Oct 03, 2005 at 11:47 UTC | |
by ultibuzz (Monk) on Oct 03, 2005 at 12:13 UTC | |
|
Re: Filter script with pattern and an array
by blazar (Canon) on Oct 03, 2005 at 11:53 UTC | |
|
Re: Filter script with pattern and an array
by ultibuzz (Monk) on Oct 03, 2005 at 18:14 UTC | |
by graff (Chancellor) on Oct 04, 2005 at 00:45 UTC | |
by ultibuzz (Monk) on Oct 20, 2005 at 15:16 UTC | |
by blazar (Canon) on Oct 04, 2005 at 07:23 UTC |