The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. Shell Script Page.


Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
PERL script problem caddyjoe77 Shell Programming and Scripting 5 07-06-2007 11:29 AM
Calling a perl script from a perl script new2ss Shell Programming and Scripting 3 02-06-2007 07:17 PM
Perl script strange problem vaibhav Shell Programming and Scripting 2 11-23-2006 03:08 AM
Perl: Run perl script in the current process vino Shell Programming and Scripting 10 12-09-2005 06:45 AM
Problem executing setuid script in perl-5.8.6 sarmakdvsr Shell Programming and Scripting 0 08-22-2005 11:11 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-19-2007
Registered User
 

Join Date: Aug 2007
Posts: 9
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Having a problem with a FTP Script using perl

Hello All,

I have a problem that has me stumped. I am using perl to do some ftp'ing of files. I have the script in place on another environment that is functioning flawlessly. But after tweaking it to the new environment I can't get it to function. I have a search string that searches for the file name and then executes the file and deletion of that file after the ftp. The only difference between the two environments is the file name is slightly different. Any help would be greatly appreciated. I use a XML file that contains the host information. I have included the following information:

Functioning Environment:
File Defination:file.serv1.YYYYMMDDhhmm-[0-9]{4}.log
File name: file.serv1.200712192300-0500.log

XML File Info:
<host_list hostname="serv1" althostname="" username="ftpuser" password="passwd">
<file_list>
<remote_dir>/app/logs</remote_dir>
<local_dir>targetlocation/targetdirectory</local_dir>
<remote_name>file.serv1.YYYYMMDDhhmm-[0-9]{4}.log</remote_name>
</file_list>

FTP PERL File:

$searchFilter = $remoteName."\$";
$searchFilter =~ s/YYYYMMDDhhmm/[0-9]{12}/;

@files = sort grep (/$searchFilter/, @files);

Non-Functioning Environment:
File Defination: fileYYYYMMDD.log
File name: file20071219.log

XML File Info:
<host_list hostname="serv1" althostname="" username="ftpuser" password="passwd">
<file_list>
<remote_dir>/app/logs</remote_dir>
<local_dir>targetlocation/targetdirectory</local_dir>
<remote_name>fileYYYYMMDD.log</remote_name>
</file_list>

FTP PERL File:

$searchFilter = $remoteName."\$";
$searchFilter =~ s/YYYYMMDD/[0-9]{8}/;

@files = sort grep (/$searchFilter/, @files);


Any Ideas?

Thanks in Advance.

Last edited by scottzx7rr : 12-19-2007 at 01:43 PM.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 12-19-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Quote:
Originally Posted by scottzx7rr View Post
$searchFilter = $remoteName."\$";
....
$searchFilter = $remoteName"\$";
You have dropped a period.
Reply With Quote
  #3 (permalink)  
Old 12-19-2007
Registered User
 

Join Date: Aug 2007
Posts: 9
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Sorry that is a typo. I have the period there. I have updated the orginal post to reflect the typo.
Reply With Quote
  #4 (permalink)  
Old 12-19-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Quote:
Originally Posted by scottzx7rr View Post
fileYYYYMMDD.log
file120071219.log
You have an extra 1 before the year date there.....
Reply With Quote
  #5 (permalink)  
Old 12-19-2007
Registered User
 

Join Date: Aug 2007
Posts: 9
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Yeah that was just the example I typed for reference. It doesn't have that 1 in the file name. Here also is the output for what it is looking for so it appears to posting the information from the xml to the ftp script but the search string appears to be the issue I think:

DEBUG [3390] : Processing Fileset: remoteDir->targetlocation/targetdirectory/, remoteName->fileYYYYMMDD.log

Last edited by scottzx7rr : 12-19-2007 at 01:55 PM.
Reply With Quote
Google UNIX.COM
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 04:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102