Hi friends,
I am facing problem in finding a code which should read particular column in text file.My code opens a file split it into an array & search the string but it search that in whole file while i want it to search in ap articular column because same string is in other columns.
My code is:
open(INFO, $file); # Open the file
open(OUT, ">OutPutFile.ou t");
while (<INFO>)
{
chomp($_);
@record=split(/\|/,$_);
if($_=~/(\d*\.0\sDC\sAN D\s\d*\.0\sDC)/)
{
$i++;
print OUT "$i $1";
@temp=split(/\|/,$1);
$t="@temp";
$t=~s/\.0\sDC\sAND\s\ d*\.0\sDC//g;
chomp($t);
print OUT "$t || V ";
$t1="@temp";
$t1=~s/\d*\.0\sDC\sAND \s//g;
$t1=~s/\.0\s\w*//g;
chomp($t1);
print OUT "$t1 || V \n";
so plz help me out.
regards
I am facing problem in finding a code which should read particular column in text file.My code opens a file split it into an array & search the string but it search that in whole file while i want it to search in ap articular column because same string is in other columns.
My code is:
open(INFO, $file); # Open the file
open(OUT, ">OutPutFile.ou t");
while (<INFO>)
{
chomp($_);
@record=split(/\|/,$_);
if($_=~/(\d*\.0\sDC\sAN D\s\d*\.0\sDC)/)
{
$i++;
print OUT "$i $1";
@temp=split(/\|/,$1);
$t="@temp";
$t=~s/\.0\sDC\sAND\s\ d*\.0\sDC//g;
chomp($t);
print OUT "$t || V ";
$t1="@temp";
$t1=~s/\d*\.0\sDC\sAND \s//g;
$t1=~s/\.0\s\w*//g;
chomp($t1);
print OUT "$t1 || V \n";
so plz help me out.
regards
Comment