Ok....
Hier mein Skript soweit ....
my $source = ""; if (opendir(VERZEICHNIS, $source)) #Öffnen des Quellverzeichnisses
{
my @verzeichnis = readdir(VERZEICHNIS);
my $anzahl = @verzeichnis
for (my $i=0; $i<$anzahl; $i++) {
my $dateipfad = "";
if (open (DATEI, $dateipfad))
{
print ">> Datei geoeffnet\n"; print "Datei: $verzeichnis[$i]\n\n"; #Testausgabe
my $txtDatei = $verzeichnis[$i].".txt"
my @datei = <DATEI>;
my $zeilenanzahl = @datei;
&txtDateierstellen ($txtDatei, $zeilenanzahl, \@datei);
}close (DATEI);
}
}closedir (VERZEICHNIS);
sub txtDateierstellen
{
my $txtDatei = $_[0];
my $zeilenanzahl = $_[1];
my @datei = @{$_[2]};
my @Position = 0;
for (my $l=0; $l<5; $l++)
{
$datei[$l] =~ /([0-9]{4})([C]{1})(.{182})/;
my $CSatz = $2.$3;
my $C1 = substr($CSatz,0,1); my $C2 = substr($CSatz,1,8);
my $C3 = substr($CSatz,9,8);
my $C4 = substr($CSatz,17,10);
my $C5 = substr($CSatz,27,13);
my $C6a = substr($CSatz,40,2);
my $C6b = substr($CSatz,42,3);
my $C7 = substr($CSatz,45,1);
my $C8 = substr($CSatz,46,11);
my $C9 = substr($CSatz,57,8);
my $C10 = substr($CSatz,65,10);
my $C11 = substr($CSatz,75,11);
my $C12 = substr($CSatz,86,3);
my $C13a = substr($CSatz,89,27);
my $C13b = substr($CSatz,116,8);
my $C14 = substr($CSatz,124,27);
my $C15 = substr($CSatz,151,27);
my $C16 = substr($CSatz,178,3);
my $C17 = substr($CSatz,181,2);
my $position = tell(DATEI);
print "Position: $position\n";
open (my $neueDatei,">>","") || ("Die Datei konnte nicht geschrieben werden\n");
........
}
}
Das ist fast der vollständige Quellcode...
Und so sieht eine Datei aus, aus der ich auslesen möchte (zu test zwecken geändert, Aufbau und das Suchmuster jedoch identisch...)
0128ARW00234563640090800xxxx xxxxxxxxxx 34636115013000000000000000200xxx 0216C60343453453453464357456111108051000 0000000000060090423435634645900008600000 xxxxxxxxx xxxxxx xxxxx xxxxx-xxxxx xxxxx xxxxxx xxxxxxxx xxxxx.41 xxxx xxxx xxxxxxx 0187C600934534543444431033603124498120208051000 0000000000060090800000077997000012600000 xxxxxxx + xxxxx xxxxxx xxxxxx xxxxxxx + xxxxxxx xxxxxxx xxxxx-xxx 000216C600908002543534534552124990120208051000 0000000000060090800000006881900001038962 xxxxxx xxxx xxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxx xxxx
..........
steht alles in einer Zeile.
Hoffe du kannst mit meinen Informationen was anfangen !!!
Danke schon im vorraus!
Datum: 25.02.2008-11:31
