Task Overview: I am writing a Perl script to look through 'input.txt' and put this data into 'output.txt".
The input.txt file looks like this:
ID=10; Strike=233; etc...
I want my output.txt file to look like this (or similar):
10,233, etc...
I have my out put looking like this, the only problem is, that I want to be able to add multiple lines to the output.txt file by adding to the ID column without chaging the input.txt file.
An example of this is:
10,233
11,233
12,233
etc...
Can anyone help me with this? He is my code:
#!/usr/bin/perl
open(FILE,"input.txt") or die("Unable to open file");
@data=<FILE>;
close(FILE);
$line = @data[0];
@splitline = split /;/, $line;
#@splitlineb = split /=/, @splitline;
foreach $piece(@splitline)
{
@fields = split /=/, $piece;
#print @fields[0];
#print "\n";
print @fields[1];
print "\n";
}
The input.txt file looks like this:
ID=10; Strike=233; etc...
I want my output.txt file to look like this (or similar):
10,233, etc...
I have my out put looking like this, the only problem is, that I want to be able to add multiple lines to the output.txt file by adding to the ID column without chaging the input.txt file.
An example of this is:
10,233
11,233
12,233
etc...
Can anyone help me with this? He is my code:
#!/usr/bin/perl
open(FILE,"input.txt") or die("Unable to open file");
@data=<FILE>;
close(FILE);
$line = @data[0];
@splitline = split /;/, $line;
#@splitlineb = split /=/, @splitline;
foreach $piece(@splitline)
{
@fields = split /=/, $piece;
#print @fields[0];
#print "\n";
print @fields[1];
print "\n";
}