hello monks !!! below is my text file which I am reading
1111111111 GENERAL BT 00318 06/08/19 CSH DE +P 1 +12.00 3336328 06/08/19 CSH DE +P 2 +24.00 3336328 06/08/19 CSH DE +P 1,2 +00.00 3336328 06/08/19 CSH DE +P 2,4 +00.00 3336328 2222222222 GREEN VALLY 00318 06/08/19 CSH DE +P 59.00 + 3336328 4226402 1111111111 GENERAL BT 00318 06/08/19 CSH DE +P 1 +12.00 3336328 06/08/19 CSH DE +P 2 +24.00 3336328 06/08/19 CSH DE +P 1,2 +00.00 3336328 06/08/19 CSH DE +P 2,4 +00.00 3336328 adadadadadadadasdsdasdasdasdadasdasdasddas 3333333333 GENERAL BT 00318 06/08/19 CSH DE +P 1 +12.00 3336328 06/08/19 CSH DE +P 2 +24.00 3336328 06/08/19 CSH DE +P 1,2 +00.00 3336328 06/08/19 CSH DE +P 2,4 +00.00 3336328 defghghghghghghghgghgh daadad adasdas asdasds asdasdasdasddasddad
I am reading line by line with matching pattern and not able to add the amount in same matched pattern array till the last csh dep so that I can move that data TO databse in specified columns. here is my code below but I am not able to achieve what I want . I am new to perl and not able to figure out how to achieve that<\p>
#!/usr/bin/perl use Net::FTP; use IO::Uncompress::Gunzip qw(gunzip $GunzipError); use Date::Simple qw(d8); use DBI; use DBIx::Dump; use Time::Piece; use Time::Seconds 'ONE_DAY'; if (open(my $fh,'< CASH_REPORT-cfpd0903.txt')){ #or die "Could not open file $!"; while (my $row1 = <$fh>) { if ($row1=~/^.*\b(CSH DEP)\b.*$/) { $row1=~s/^\s+//; my $row2 = $row1; #print "$row1 sachin is here \n"; my @sachin = split/\s+/,$row2; print "@sachin printing array\n"; } }
In reply to Issue in parsing data from file by sachin raj aryan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |