in reply to Re: Selection of a part of a text
in thread Selection of a part of a text
141 142 143 REGULATION SLOT LAYOUT + REGULATED FLIGHTS 144
my $file = "$ARGV[0]"; ################# END OF THE DECLARATION OF THE ARGUMENTS my $Current_Dir = `pwd`; # print STDOUT "the current directory is $Current_Dir"; # open the ALL_FT file open(INFILE,"$ARGV[0]") or die "Can't open $ARGV[0]: $!"; # name of the OUTFILE # do not forget the "" if # never put a \n at the end of the OUTFILE name otherwise it does not +create the output my ${outfile_name} = "bon_format_$file"; # to open the file # OUTFILE is the name of the HANDLE in this case open (OUTFILE, ">${outfile_name}.csv") or die "Can't open ${outfile_ +name}.csv: $!"; my @Parts; my $part; while (<INFILE>) { if (/^143/..eof(INFILE)){ # the lines are composed of elements separated by a point comma my $Line = $_; my @Elements = split(";", $Line); my $element = $Elements[1]; @Parts = split(" ",$element); foreach $part(@Parts){ print OUTFILE ";$part"; } print OUTFILE "\n"; } } close INFILE; close OUTFILE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Selection of a part of a text
by GrandFather (Saint) on Jul 30, 2007 at 10:28 UTC | |
|
Re^3: Selection of a part of a text
by steph_bow (Pilgrim) on Jul 30, 2007 at 10:11 UTC |