Reducing file names


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Reducing file names
# 1  
Old 10-12-2006
Reducing file names

I have a script which includes an FTP. The filename is too long for my target area. The filename is HD012_ABCD_EFGH_061004_F_300_40. I need to the filename to be HD012_ABCD_EFGH_061004_F_. Any ideas.
# 2  
Old 10-12-2006
ftp supports renaming files with either get or put
Code:
put oldfilename newfilename
get oldfilename newfilename

# 3  
Old 10-12-2006
I'm using mget, which gets a collection of files in one call. The files appear in a directory on the Unix server and then need to be moved.
# 4  
Old 10-12-2006
Code:
cd /path/to/directory
echo "
open remote_node
USER username passwd
verbose
cd /destination
`ls pattern* | \
  while read file do
  do
     echo put "$file"  `expr substr $file 1 20`
  done `
  bye
  " | ftp > ftp.log

# 5  
Old 10-12-2006
The FTP code is as follows.

user $RCV $pass
binary
mget ${FID}_*_${RCV}_*_F_*
bye


It is at the '_F_' i need to reduce the file name.
I do not know the filename length at this stage, as $FID and $RCV could be different lengths
# 6  
Old 10-12-2006
Sorry Jim

I misread what you put.
This works perfectly thank you.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Reducing / on rootvg

The root filesystem was mirrored, someone/something stopped mirroring, and increased / and /home to ridiculous values (/ got increased to 102gb and its only using 4.3gb, so 98gb is free). Can I reduce the / (/dev/hd4) filesytem down WITHOUT corrupting the the OS? I would do a: chfs -a size=10g... (6 Replies)
Discussion started by: mrmurdock
6 Replies

2. UNIX for Beginners Questions & Answers

Reducing input file size after pattern search

I have a very large file with millions of entries identified by @M. I am using the following script to "extract" entries based on specific strings/patterns: #!/bin/bash if ] then file=$1 else echo "Input_file passed as an argument $1 is NOT found." exit; fi MID=(NULL "string-1"... (10 Replies)
Discussion started by: Xterra
10 Replies

3. Shell Programming and Scripting

Exclude certain file names while selectingData files coming in different names in a file name called

Data files coming in different names in a file name called process.txt. 1. shipments_yyyymmdd.gz 2 Order_yyyymmdd.gz 3. Invoice_yyyymmdd.gz 4. globalorder_yyyymmdd.gz The process needs to discard all the below files and only process two of the 4 file names available ... (1 Reply)
Discussion started by: dsravanam
1 Replies

4. Shell Programming and Scripting

Reducing the decimal points of numbers (3d coordinates) in a file; how to input data to e.g. Python

I have a file full of coordinates of the form: 37.68899917602539 58.07500076293945 57.79100036621094 The numbers don't always have the same number of decimal points. I need to reduce the decimal points of all the numbers (there are 128 rows of 3 numbers) to 2. I have tried to do this... (2 Replies)
Discussion started by: crunchgargoyle
2 Replies

5. Shell Programming and Scripting

Reducing text file using similar lines

Hello, I am a java programmer but want to try unix for a purpose where I need to reduce a file using its first field.. Here is the sample data: admin;2;0;; admission;8;0;; aman;1;0;; caroline;0;4;; cook;0;4;; cook;2;0;; far;0;3;; far;1;5;; I am explaining the dataset first. There... (5 Replies)
Discussion started by: shekhar2010us
5 Replies

6. Shell Programming and Scripting

Split File by Pattern with File Names in Source File... Awk?

Hi all, I'm pretty new to Shell scripting and I need some help to split a source text file into multiple files. The source has a row with pattern where the file needs to be split, and the pattern row also contains the file name of the destination for that specific piece. Here is an example: ... (2 Replies)
Discussion started by: cul8er
2 Replies

7. Shell Programming and Scripting

Reducing file lines in awk

Hi, Here i have to check first record $3 $4 with second record $1 $2 respectively. If match found, then check first record $2 == second record $4 , if it equals , then reduce two records to single record like as desired output. Input_file 1 1 2 1 2 1 3 1 3 1 4 1 3 1 3 2 desired... (3 Replies)
Discussion started by: vasanth.vadalur
3 Replies

8. Shell Programming and Scripting

Searching for file names in a directory while ignoring certain file names

Sun Solaris Unix Question Haven't been able to find any solution for this situation. Let's just say the file names listed below exist in a directory. I want the find command to find all files in this directory but at the same time I want to eliminate certain file names or files with certain... (2 Replies)
Discussion started by: 2reperry
2 Replies

9. Solaris

reducing to root file size

My root file size has reached 80% and I am looking where all i can reduce the file size . Here is the output of top directories in / . To me none of this looks useful but not sure . We use an appplication and email. Which all can be deleted . Please advise . 2016989 989445 /var 930059 ... (2 Replies)
Discussion started by: Hitesh Shah
2 Replies

10. Shell Programming and Scripting

Reading file names from a file and executing the relative file from shell script

Hi How can i dynamically read files names from a list file and execute them from a single shell script. Please help its urgent Thanks in Advance (4 Replies)
Discussion started by: anushilrai
4 Replies
Login or Register to Ask a Question