Dynamically creating file names from portions of another file name
Not sure how to do the following, but any help would be appreciated.
Has to be done using C shell (sorry about that).
I have about 300 files that I need this done for, but I am only going to give one example. I will just need to know how to execute your solution through some type of loop to get all three files.
I have a file named aaa.ccyymmdd.dat.gz.
I need to copy that file to a new name, but take the ccyymmdd out of the original filename and put it into the name of the new filename.
Final output would be xyz.ccyymmdd.dat.gz.
Example:
I have files:
and need to run something that will ls or list all the files, loop through them, copy the file over BUT name it:
MY BIGGEST CONCERN IS HOW TO SETUP THE LOOP.
Any help would be greatly appreciated.
Thanks.
Last edited by Scrutinizer; 05-18-2013 at 12:47 PM..
Reason: code tags
I've written an awk script to compare two fields in two different files and then print portions of each file on the same line when matched. It works reasonably well, but every now and again, I notice some errors and cannot seem to figure out what the issue may be and am turning to you for help.
... (2 Replies)
I have two files and desire to use the strings from $1 of file 1 (file1.txt) as search criteria to find matches in $2 of file 2 (file2.txt). If matches are found I want to output the entire line of file 2 (file2.txt) followed by fields $2-$11 of file 1 (file1.txt). I can find the matches, I cannot... (7 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)
Hi Guru's,
I am new to shell scripting. I have a unique requirement:
The system generates a single pdf(/tmp/ABC.pdf) file with Invoices for Multiple Customers, the format is something like this:
Page1 >> Customer 1 >>Invoice1 + invoice 2 >> Page1 end
Page2 >> Customer 2 >>Invoice 3 + Invoice 4... (3 Replies)
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)
Hi,
I'm trying to use a config file to define frequencies for checking log files. If the config file contains a frequency it will be used else a default value. The format of the config file (and hence the environment variable) is
FREQ_log_logname=value
A test shell script as below:... (2 Replies)
I am wondering how I can save the file names (stored in $file or $fnames) in array which I can access with an index.
alias MATH 'set \!:1 = `echo "\!:3-$" | bc -l`'
set narg = $#argv
while ($iarg < $narg)
MATH iarg = $iarg + 1
set arg = $argv
set opt = ` echo $arg | awk... (1 Reply)
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)
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)
hello
I have loop , in this loop im picking names , this names I want to be keys in %hash
but I don't know how to set in every loop entertain different key in the %hash (1 Reply)