![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| shell program | nivas | Shell Programming and Scripting | 8 | 02-21-2008 05:23 AM |
| help with shell program | adgarg | Shell Programming and Scripting | 3 | 10-31-2007 06:54 AM |
| shell program | rameshparsa | Shell Programming and Scripting | 1 | 11-17-2005 01:18 PM |
| Shell Program | TexasGuy | High Level Programming | 3 | 03-12-2005 02:11 AM |
| Help me with this Shell Program | TRUEST | Shell Programming and Scripting | 1 | 04-08-2002 12:58 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Shell Program , need help!!
Hi all,
I am trying to get a file from an ftp server and i have the list of files which needs to be get from the ftp server. grep unix_prg*.* log.txt > log1.txt log1.txt (which has the list of files) 06-29-09 00:00AM 3550258 unix_prg090629 06-28-09 07:00PM 115733 unix_prg090628 06-27-09 07:02AM 1025004 unix_prg090627 06-26-09 07:12PM 5399554 unix_prg090626 06-25-09 07:09PM 4111899 unix_prg090625 06-24-09 07:05PM 2012520 unix_prg090624 06-23-09 07:07PM 2950387 unix_prg090623 06-22-09 07:09PM 4080367 unix_prg090622 06-21-09 07:01PM 322285 unix_prg090621 if i am using the command head -1 log1.txt > log2.txt log2.txt (output file) 06-29-09 00:00AM 3550258 unix_prg090629 i got the exact file which i need to take it from ftp server. How can i invoke the same , i need a way to get the file from that server ?? Just need to login to the ftp server and get the file which is printed in log2.txt Thanks!! |
|
||||
|
|
|
||||
|
Quote:
Can anyone help me on this ?? Thanks! |
|
||||
|
Code:
ftp -nv $HOST > log.txt << END_SCRIPT quote USER $USER_show quote PASS $PASSWD_show1 cd unix1 ls -ltr quit exit 0 grep unix_prg*.* log.txt > log1.txt head -1 log1.txt > log2.txt Code:
06-29-09 00:00AM 3550258 unix_prg090629 06-28-09 07:00PM 115733 unix_prg090628 06-27-09 07:02AM 1025004 unix_prg090627 06-26-09 07:12PM 5399554 unix_prg090626 06-25-09 07:09PM 4111899 unix_prg090625 06-24-09 07:05PM 2012520 unix_prg090624 06-23-09 07:07PM 2950387 unix_prg090623 06-22-09 07:09PM 4080367 unix_prg090622 06-21-09 07:01PM 322285 unix_prg090621 log2.txt (output file) Code:
06-29-09 00:00AM 3550258 unix_prg090629 from here i am not sure how to get the file which is in log2.txt ?? thanks Last edited by vgersh99; 07-10-2009 at 09:26 AM.. Reason: code tags, PLEASE! |
| Bits Awarded / Charged to raghav1982 for this Post | |||
| Date | User | Comment | Amount |
| 07-10-2009 | vgersh99 | added code tags - charged 5K bits | -5,000 |
|
||||
|
This is the sample script to ftp a file.
Code:
HOST='host' USER='yourid' PASSWD='yourpw' LOCAL_PATH='path' REMOTE_PATH='remote_path' FILE='filename' ftp -n <<EOF open $HOST user $USER $PASSWD cd $REMOTE_PATH get $FILE $LOCAL_PATH quit EOF exit 0 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|