L
LHradowy
I have been able to prompt user for data, then use join to add it to the
data. But, I need to go further.
First off I need to open the file, right now I just type script.pl <file>
Then I need to take the output of the data, and put it into a file. I have
tried opening then print to it, then close the file but it does not work.
Actually I need to do 3 things, print the join, then grep for CUST and send
that to a file, grep for TELN send that to a file, and grep -v and send
everything that does not have CUST of TELN to another file.
#!/opt/perl/bin/perl
system ("clear"); #Clear the screen
$acode="204";
$[ = 1; # set array base to 1
$, = ','; # set output field separator
$\ = "\n"; # set output record separator
Enter BLD: $room=<STDIN> ; chomp $room;
print "Enter ROOM:"; $room=<STDIN> ; chomp $room;
$[ = 1; # set array base to 1
$, = ','; # set output field separator
$\ = "\n"; # set output record separator
while(<ARGV>) {
chomp;
@a=split(",",$_);
print FH join(",",$acode.$a[0],$bld,$room,$a[2],$a[3],"\n") ;
}
data. But, I need to go further.
First off I need to open the file, right now I just type script.pl <file>
Then I need to take the output of the data, and put it into a file. I have
tried opening then print to it, then close the file but it does not work.
Actually I need to do 3 things, print the join, then grep for CUST and send
that to a file, grep for TELN send that to a file, and grep -v and send
everything that does not have CUST of TELN to another file.
#!/opt/perl/bin/perl
system ("clear"); #Clear the screen
$acode="204";
$[ = 1; # set array base to 1
$, = ','; # set output field separator
$\ = "\n"; # set output record separator
Enter BLD: $room=<STDIN> ; chomp $room;
print "Enter ROOM:"; $room=<STDIN> ; chomp $room;
$[ = 1; # set array base to 1
$, = ','; # set output field separator
$\ = "\n"; # set output record separator
while(<ARGV>) {
chomp;
@a=split(",",$_);
print FH join(",",$acode.$a[0],$bld,$room,$a[2],$a[3],"\n") ;
}