The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Tricky Shell script namishtiwari Shell Programming and Scripting 61 08-23-2007 07:26 AM
tricky search replace: Pls help. vaibhavs Shell Programming and Scripting 5 06-11-2007 03:44 PM
Tricky Sed bestbuyernc Shell Programming and Scripting 2 11-22-2005 01:03 PM
Tricky one... saabir Windows & DOS: Issues & Discussions 1 12-12-2002 05:34 PM
Tricky File Permission Question Hook Filesystems, Disks and Memory 3 07-16-2002 04:25 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 06-27-2006
budrito budrito is offline
Registered User
  
 

Join Date: Jul 2002
Posts: 22
Tricky script question

Hi,

I'm in the midst of writing a UNIX script that sftp's files to an external host and am stuck with a problem. The problem is that the files created on my server as a order number that correlates to a sequence of directories on the remote host which is where the file should be ftp'ed.

Example:
My server filename:
myserver> /home/ 572011 O4MP ORDS 188406 V01 DT 20060608154548.txt

The 4th field (188406 ) in my filename correlates to a directory on the remote server where the file should be store. So on the remote server we should be sftp'ing this file to path

Remote Server:
remoteserver> /Test Documents/TestOrders/180001-190000/188001-189000/188401-188500/188406

The remote server has about 30+ directories and sub-directory ranges created to facilitate this file transfer. Remote server directory listings as range level and sub directories follow:
100001-110000 110001-120000
180001-190000 270001-280000 300001-310000 320001-330000
330001-340000 350001-360000 370001-380000 380001-390000
390001-400000 400001-410000 410001-420000 420001-430000
430001-440000 440001-450000 450001-460000 460001-470000
470001-480000 480001-490000 490001-500000 500001-510000
510001-520000 520001-530000 530001-540000 540001-550000
550001-560000 560001-570000 570001-580000 580001-590000
590001-600000 600001-610000

So another example would be that if we received a filename:
/home/ 572011 O4MP ORDS 588406 V01 DT 20060608154548.txt (Note: 588406 is the directory to be stored on remote site as explained above)

How can I make the script smart enough for it to look at the forth field in my file name and sftp it on the remote server path:
remoteserver> /Test Documents/TestOrders/580001-590000/588001-589000/588401-588500/588406

This is for #!/bin/sh, #!/bin/csh or #!/bin/ksh and based on HP-UX 11i.

Your assistance would be greatly appreciated.

Thanks.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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

BB 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 -4. The time now is 01:41 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0