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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
insert text into the middle of a original file mopimp Shell Programming and Scripting 1 03-26-2006 07:11 AM
ftp - get file and keep original timestamp? frustrated1 Shell Programming and Scripting 2 03-15-2006 10:31 AM
accessing o an exact line in a file walnut Shell Programming and Scripting 2 02-23-2006 01:31 PM
how to find the exact pattern from a file? surjyap Shell Programming and Scripting 7 12-05-2005 06:00 AM
Help with multiple file rename - change case of part of file name steve7 UNIX for Dummies Questions & Answers 7 06-30-2005 10:41 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 03-06-2006
Registered User
 

Join Date: Mar 2006
Posts: 4
vgersh99, it seems to me that with nmap you are assigning values to variables ($1 and $3 in your example) and using those variables to re-format the string.

However, I did just realize that I also have to rename the _IN.TXT to lowercase. Does this mean the 2nd option is better?

Thanks again
Reply With Quote
Forum Sponsor
  #9  
Old 03-06-2006
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,016
you can try:
Code:
ftp host
    nmap $1_$2_$3 $1_$3
    case
    mget SCA*.TXT
to map all CAPs to low case....
You can play with either 'nmap' and/or 'macdef' to get the desired result OR go the 'post processing' route, but it might interesting to figure out how to do it natively within ftp.
Reply With Quote
  #10  
Old 03-07-2006
Klashxx's Avatar
HP-UX/Linux/Oracle
 

Join Date: Feb 2006
Location: Almerķa, Spain
Posts: 383
Althought this is more complicated ,u can try:

for EXT_FILE in $(ftp -n ${HOST} < files.ftp | grep -vE "^Passive|^total" |grep -v active|awk -F\SCA '{print $2}')
do
echo ${EXT_FILE} >>files_ext-list.tmp
done

cat files_ext-list.tmp|while read EXT_FILE
do
EXT_FILE2="$(echo ${EXT_FILE}|awk -F\_ '{print $1}')_in.txt"
echo "define(EXT_FILE,${EXT_FILE}) define(EXT_FILE2,${EXT_FILE2})" > out.macros
cat out.macros download_files.ftp | m4 -B64556 > temp.ftp
ftp -n ${HOST} < temp.ftp
done


Where:


cat files.ftp

user username password
passive
dir
bye


cat download_files.ftp

user username password
passive
get "SCA""EXT_FILE" "SCA""EXT_FILE2"
bye



Cheers
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




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


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

Content Relevant URLs by vBSEO 3.2.0