07-02-2008
Perl report problem...
Hi All,
As my old group friends knows, I know shell scripting but very new to perl scripting. Hence struggling now for the simple task. This should be done using perl. Any help for the below requirement would be greatful for me...
I've around 40 files, with the below layout:
file1.csv
C01;35047
C02;0
C03;0
C04;0
C05;1294
C06;0
C07;0
C08;0
file2.csv
C01;197874
C02;20
C03;9
C04;0
C05;0
C06;0
C07;406
C08;0
and so on up to 40 files.
I've to read all the 40 files and for the non-zero second column I need the count and total values in to a summary file 'summary_report.csv'.
Example Final Report should be as below:
C01;35047
C02;20001
C03;3002
C04;32224
C05;1294
C06;23
C07;8474
C08;737
Till now I've build the code as below:
my $report_dir = "$prereq_dir/REPORTS";
opendir DIR, $report_dir || die "Cannot opendir $report_dir $!";
while ( $filename = readdir(DIR) )
{
open(PAGE, $filename) || die "I can't open $filename";
Iam struggling to find the second field, count and totalling the values.
Any light on my dark way would be much appreciated...
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I'm trying in vain to workout how I can generate a report from a months worth of files that get created every day. There is one file per day and each daily file contain the output from a df -v command.
With the following section of code ...
for xdffile in $1$2/df??
do
... (4 Replies)
Discussion started by: Cameron
4 Replies
2. Shell Programming and Scripting
I have been recently given a PERL script to develop, but the main problem is that the perl version that I have to use is old, also I cant download modules from CPAN.
Perl version 5.0005
I didnt realise this untill I had the script ready to be tested, so there are a few modules that I have... (6 Replies)
Discussion started by: meevagh
6 Replies
3. Shell Programming and Scripting
hi,
i have a script that coverts the file time in epoch time.but the problem is perl is not working inside the k-shell
----------------------------------------------------------------
#!/bin/ksh
echo "Enter the file"
read n
perl -e 'print ((stat("n")))'... (6 Replies)
Discussion started by: ali560045
6 Replies
4. Programming
I am trying to run the following script which is a file format converter. The frame variable in the input file has a file of 3,2,1 which needs to be 0,1,2 respectively i.e. 3 =0 etc.
I have included the tr/// function into the script to do this, however it does not seem to be working
input its... (2 Replies)
Discussion started by: fordie
2 Replies
5. Shell Programming and Scripting
Hi all,
we do have daily oracle database backups and i need to generate report of each database start point and end point
we are using netapp snapshot(filer level) for backups.
all backups logs will be come in one directory
/u01/app/oracle/backup/hostname/log/*
here... (7 Replies)
Discussion started by: prakashdba2010
7 Replies
6. Shell Programming and Scripting
Hello everyone,
I have a list of inputs as below. My logic is to get the particular powerdisk which matches for ASM disk which means take the major & minor number of each asm disk and matches with powerdisk info then get the particular powerdisk
$ ls -l /dev/asm_* ---> ASM disk info... (11 Replies)
Discussion started by: kannan84
11 Replies
7. Web Development
Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect.
Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is
redirected to welcome page.
My... (3 Replies)
Discussion started by: Arun_Linux
3 Replies
8. Shell Programming and Scripting
Hello,
I have a large amount of data with the following structure:
Word=Transliterated word
I have written a Perl Script (reproduced below) which goes through the full file and identifies all dupes on the right hand side. It creates successfully a new file with two headers: Singletons and Dupes.... (5 Replies)
Discussion started by: gimley
5 Replies
9. Shell Programming and Scripting
Hi,
I have a perl script to read the log file and create a report from it. I have the script file and log file in a different directories. Now i have pipe the log file data to the perl script to create the report (HMTL file). I am using the below command this isn't working
tail -f... (4 Replies)
Discussion started by: vel4ever
4 Replies
PFUNC(1p) User Contributed Perl Documentation PFUNC(1p)
NAME
pfunc - grep for perl functions
SYNOPSIS
pfunc subroutine FILES...
DESCRIPTION
pfunc searches the named FILES for all calls to the given subroutine. It will report back the file and line number each call is found on
along with what sort of call it is
function foo()
class method Class->foo()
object method $obj->foo()
EXAMPLE
$ pfunc isa /usr/share/perl/5.6.1/*.pm
Called as function in /usr/share/perl/5.6.1/CGI.pm at line 316
Called as function in /usr/share/perl/5.6.1/CGI.pm at line 327
Called as function in /usr/share/perl/5.6.1/CGI.pm at line 397
Called as function in /usr/share/perl/5.6.1/CGI.pm at line 494
Called as function in /usr/share/perl/5.6.1/CGI.pm at line 495
Called as object method in /usr/share/perl/5.6.1/CPAN.pm at line 4957
Called as function in /usr/share/perl/5.6.1/Dumpvalue.pm at line 191
Called as function in /usr/share/perl/5.6.1/Dumpvalue.pm at line 218
Called as function in /usr/share/perl/5.6.1/Dumpvalue.pm at line 248
Called as function in /usr/share/perl/5.6.1/Dumpvalue.pm at line 251
Called as function in /usr/share/perl/5.6.1/Dumpvalue.pm at line 254
Called as object method in /usr/share/perl/5.6.1/Shell.pm at line 28
Called as object method in /usr/share/perl/5.6.1/base.pm at line 12
NOTES
Its not fast, but its accurate.
AUTHOR
Michael G Schwern <schwern@pobox.com>
SEE ALSO
Module::Info
perl v5.10.1 2010-10-03 PFUNC(1p)