steph_bow has asked for the wisdom of the Perl Monks concerning the following question:
AAD; ;CCR;365 TEC;UTF;TDE;450 TRE; ;FTE;164 TEC;URT;TDE;687 ERT; ;ETR;567 TEC;UGC;TDE;687
TEC;UTF;TDE;450 TEC;URT;TDE;687 TEC;UGC;TDE;687
update : proposition of code#!/usr/bin/perl use strict; use warnings; use diagnostics; # la commade "use strict" permet d'être plus rigoureux ############################################## # TASKS MADE BY THE SCRIPT ############################################## # the task of this script is to look for the following aircraft_id ################################## ## ARGUMENTS OF THE SCRIPT ################################## ##################################### # do not forget the $ before the ARGV ##################################### # THE FIRST ARGUMENT : # we have to give the name of the regulation which will help us to ope +n the first file # the name of the first file to open is : Regulation_Slot_List_${reg_ +id} my ${Reg_Id} = "$ARGV[0]"; ################# END OF THE DECLARATION OF THE ARGUMENTS ################# IN WHICH DIRECTORY WE ARE ######################## my $Current_Dir = `pwd`; print STDOUT "the current directory is $Current_Dir"; ##################################################################### ################### OPEN THE ANALYSIS INFILE ######################### +### # open the first file # do not forget the "" to declare my ${analysis_file} = my ${analysis_file} = "Analysis_Regulation_Slot_List_${Reg_Id}_last.cs +v"; open(INFILE,"${analysis_file}") or die "Can't open ${analysis_file} : +$!"; ###################################################################### +##### ################### OPEN THE OUTFILE ############################ # open the first file # do not forget the "" to declare my ${analysis_file} = my $outfile = "with_ALL_FT_${analysis_file}"; open(OUTFILE,">${outfile}") or die "Can't open ${outfile} : $!"; ###################################################################### +##### # we want to skip the first line of the INFILE <INFILE>; while (<INFILE>){ my @Elements = split(/;/,$_); if ($Elements[1] ne ' '){ print OUTFILE "$_"; } } close INFILE; close OUTFILE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: select elements in a list
by FunkyMonk (Bishop) on Aug 06, 2007 at 14:24 UTC | |
| |
|
Re: select elements in a list
by Fletch (Bishop) on Aug 06, 2007 at 14:23 UTC | |
|
Re: select elements in a list
by toolic (Bishop) on Aug 06, 2007 at 14:27 UTC | |
|
Re: select elements in a list
by hilitai (Monk) on Aug 06, 2007 at 14:26 UTC | |
|
Re: select elements in a list
by merlyn (Sage) on Aug 07, 2007 at 17:25 UTC |