![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | 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. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#8
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#9
|
||||
|
||||
|
you can try:
Code:
ftp host
nmap $1_$2_$3 $1_$3
case
mget SCA*.TXT
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. |
|
#10
|
||||
|
||||
|
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 |
||||
| Google The UNIX and Linux Forums |