Advertisement

06.05.2008 at 03:27PM PDT, ID: 23462140
[x]
Attachment Details

Perl parsing files on remote server

Asked by saibsk in Perl Programming Language

In my shell script I have to parse three files which are on the remote server and retrieve the date from the files. I wrote this command to retrieve the 3 files but how would I parse the files? Should I scp them to my local machine or should I just parse the files on the remote machines/

This is the command to retreive the files
ssh user\@qsapp05 "cd /d1/di//log; ls -ltr | tail -3  | cut -d' ' -f16"

This is my script for parsing the files:

my %Months = (Jan => '01', Feb => '02', Mar => '03',
              Apr => '04', May => '05', Jun => '06',
              Jul => '07', Aug => '08', Sep => '09',
              Oct => '10', Nov => '11', Dec => '12');

open(OUT, ">>$home/Monitoring/test.txt") or die "test.txt: $!\n";
foreach my $file (@listOfFiles){
        print "File: $file\n";
        my $name = $1 if (split(/_/,$file))[1] =~ /AS(.*)NDR/;
        $nameUpdate = 'Positions' if $name =~ /position/;
        $nameUpdate = 'Balances' if $name =~ /balance/;
        $nameUpdate = 'Transactions' if $name =~ /Tranx/;
        warn "Could not open $file: $!\n",next unless open (FH, "<$file");
        my @times = ();
        while (<FH>){
        if(/(\w+)\s+(\d+)\s+(\S+)\s+EST\s+(\d+)/){
        push @times, $3;
        push @dates, "$Months{$1}/$2/$4";
        }
}
I need to merge them please advise.Start Free Trial
[+][-]06.05.2008 at 03:40PM PDT, ID: 21724690

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.05.2008 at 03:43PM PDT, ID: 21724711

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.05.2008 at 03:46PM PDT, ID: 21724723

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.05.2008 at 04:47PM PDT, ID: 21725008

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.06.2008 at 04:31AM PDT, ID: 21727967

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.06.2008 at 04:47AM PDT, ID: 21728033

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.06.2008 at 05:05AM PDT, ID: 21728126

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.06.2008 at 05:05AM PDT, ID: 21728133

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.06.2008 at 05:29AM PDT, ID: 21728312

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.13.2008 at 09:52AM PDT, ID: 21780697

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.16.2008 at 01:23PM PDT, ID: 21797149

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.23.2008 at 09:07AM PDT, ID: 21847635

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 06:40AM PDT, ID: 21925279

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.07.2008 at 10:22AM PDT, ID: 21946882

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Sign Up Now!
Solution Provided By: Adam314
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628