Extract file names from file and set variable to 'highest' one
HI Folks -
I have a requirement where I need to scan a text file for a list of files.
The file, we'll called it, files.txt looks like such:
I need to scan the file, searching for this string:
outbox/logs/Client_
Once found, I then need to understand if that string is suffixed with the highest numerical value on the end and then set that name (less the path) to a variable.
There will always be 4 digits and the 'highest' one is always the latest, which I need to extract.
I have done this on batch with ease but struggling here. I am using bash.
As part of a bash the below line strips off a numerical prefix from directory 1 to search for in directory 2.
for file in /home/cmccabe/Desktop/comparison/missing/*.txt
do
file1=${file##*/} # Strip off directory
getprefix=${file1%%_*.txt}
... (5 Replies)
Hi guys
I'm a beginner in fortran. So excuse me for my naivety, let me briefly describe what I was trying to do. I have let's say 2 files named reac-1 and reac-2. After opening these files I've to do some calculations, close these files and open the same files again in a loop. So my faulty code... (6 Replies)
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)
I'm trying to extract a list of each .cfg file name mentioned in a file. I've made some progress using sed, but I'm still not there. Any help would be appreciated.
My input looks like this:
07:00:00.000 spn redo
08:04:36.200 CMD OBJ_INIT
08:04:37.200 CMD OBJ_INIT ... (8 Replies)
I wish to assign file names with particular extention to array variables. For example if there are 5 files with .dat extention in /home/sam then i have to assign these 5 files to an array.
plz help me how to accomplish this.
Thanks in advance. (4 Replies)
Hi all,
I am trying to get a list of all the .tif images in my folder and set a variable that holds all the file names using C shell.
What is the best way to do it?
any help would be greatly appreciated.
Yang (4 Replies)
I have these files in a directory. It may have more class than the sample below:
DEPT_CHEM101LEC_D_20110301.DAT
DEPT_CHEM101LAB_D_20110301.DAT
DEPT_BIO105LEC_D_20110325.DAT
DEPT_BIO105LAB_D_20110325.DAT
DEPT_CSC308LEC_D_20110327.DAT
DEPT_CSC308LAB_D_20110327.DAT
Is there way to extract out... (5 Replies)
Hi
I have a text file (mytext.txt), the content of which is as following:
My name is <@MY_NAME@> and my age is <@MY_AGE@> .
Now i have another property file (myprops) which is as following:
MY_NAME=abcdefgh
MY_AGE=000000
I was wondering, how can i replace the tags of mytext.txt, with its... (1 Reply)
Hi All ,
I am having confusion in a shell script. Please guide me.
I need to get multiple files (number of files vary time to time, file names are separated by '|') using FTP get from the remote server.
Actually, i call the FTP function in a loop. At the last step, i need to move all the get... (3 Replies)
I am trying to process error files in selected directories. I can count the files that are there and export the contents to a file for either emailing or printing. The next step is to move the files to a processed directory with the name changed to .fixed as the last extension.
for file in... (2 Replies)