Taking part of one file name and putting it into a 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 data.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 newdata.ccyymmdd.dat.gz.
Example:
I have
and need to run something that will ls or list all the files, loop through them, copy the file over BUT name it:
Any help would be greatly appreciated.
Thanks.
Last edited by joeyg; 05-16-2013 at 12:07 PM..
Reason: Please wrap commands and data inside CodeTags - easier to read
This solution is great, but I think I might not have explained it correctly. i don't need the entire file name copied over, but just a portion. In my original example, there is a node in the file name that is a date, I just need the take that date and plug it into the new file name.
I will use part of your example, but modify it slightly. My output needs to be: I am not sure how to get to/extract/cut out that date and how to put it in the new file name.
Thanks.
Last edited by Franklin52; 05-17-2013 at 03:21 AM..
Reason: Code tags
Hi,
Below is my requirement
File1:
svasjsdhvassdvasdhhgvasddhvasdhasdjhvasdjsahvasdjvdasjdvvsadjhv
vdjvsdjasvdasdjbasdjbasdjhasbdasjhdbjheasbdasjdsajhbjasbjasbhddjb
svfsdhgvfdshgvfsdhfvsdadhfvsajhvasjdhvsajhdvsadjvhasjhdvjhsadjahs
File2:
sdh
hgv
I need a command such that... (8 Replies)
Hello Members,
Need your expert opinion how to tackle below.
I have an input file that looks like below:
USS|AWCC|AFGAW|93|70
USSAA|Roshan TDCA|AFGTD|93|72,79
ALB|Vodafone|ALBVF|355|69
ALGEE|Wataniya (Nedjma)|DZAWT|213|50,550
I like output file in below format:
... (7 Replies)
I have a postgres sql statement that is the following:
select age from students;
which gives me the entries:
Age
---
10
15
13
12
9
14
10
which is about 7 rows of data.
Now what I would like to do with this is use a shell script to create an array age. As a results... (3 Replies)
I have a bunch of files with unique names. Inside each file are either 1 or more than 1 rows. I would like the name of the file to appear inside the file itself, once per row (except for the first row which is a header). For example:
ls
dog.1 cat.1 goat.1 tree.1
cat dog.1
... (4 Replies)
hi,
i am having a file which contains the below content, i need to take the word count of if and print the file name also
inputfile.txt
file_name1.txt,type_name1.txt
file_name2.txt,type_name2.txt
i would need the word count of the files like this
if file_name*.txt
then
wc -l... (10 Replies)
I need to install a bin file in UNIX which requires user interaction for giving some information like user id , path, sid etc. All these information is stored in a properties file in the same location.
So if i give ./file.bin -f propfile.properties will it install the file taking all the... (1 Reply)
Hi,
I'm working on a script which has to copy multiple files from one server to another server. The list of files that are to be copied is present in a file say input.txt.
vi input.txt
abc.c
welcome.c
new.c
welcome1.c
for ftp'ing a single file say 'new.c' the following code... (2 Replies)
Hi
I have a file that is organized like this. Basically the name is indicated by >name, then on a newline there is a sequence of letters. The letters are ASKL however sometimes there are non ASKL's like U's, G's or O's. Basically what I want to do is cut out the UUUU and record them. So heres... (4 Replies)
Hello All,
I have a file which contain data something like this:
CELL 2 TEST AND DIAGNOSTIC UNIT 2
CELL 2, CDM 1 CBR 1 TRANSMIT PORT (TXPORT) 1
CELL 2, CDM 1 CBR 2 TRANSMIT PORT (TXPORT) 1
CELL 2, CDM 1 CBR 3 TRANSMIT PORT (TXPORT) 1
CELL 2, CDM 1 CBR 1 TRANSMIT PORT... (21 Replies)