09-15-2007
Quote:
These files are in a loop so when i get first file say a.txt,
i need to rename it to a09142007.txt and continue. But for some text processing i need this file in same loop. I am getting error that file does not exists.
Once you have renamed a.txt to a09142007.txt, you will not find the file a.txt for next processing, will you ?
instead of moving the file a.txt to a09142007.txt , copy it and then do your next processing with a.txt and remove it at the end.
Hope i am clear. If you need further help , please post your script.
10 More Discussions You Might Find Interesting
1. UNIX Desktop Questions & Answers
Hi,
Is it possible to rename files at a time in a directory without using the for loop. (ex: intial filename- abc.txt to abc.tmp or abc.txt.tmp)
I need to rename the files in a remote directory to which I'm connecting thru tectia sftp. The commands 'mv', 'for', 'echo' do not work.
I have... (3 Replies)
Discussion started by: Qwerty123
3 Replies
2. UNIX for Dummies Questions & Answers
I want to change the name of some of my files (mypics-0001, mypics-0002, mypics-0003.....mypics-0240) and I want to double check to see if this code is right:
x=0
until
do
sed 's/mypics\-*/bday/g'
done
Would this change all of my file names to "bday0001....bday0240"?
Please let me... (0 Replies)
Discussion started by: jvpike
0 Replies
3. Linux
Hi,
i need to write a shell script where i have to loop through all the file in a directory and rename them based on below condition.
file1.dat
file2.dat
file3.dat
the above files has to be moved to another directory like below
file1_201001.dat
file2_201002.dat
file3_201003.dat... (3 Replies)
Discussion started by: feroz
3 Replies
4. UNIX for Dummies Questions & Answers
Okay so here's something that's confusing me: I have a script that's designed to remove the words "new_" from the front of any file except two exceptions and it looks something like this...
for i in new_*
do
if ] && ]; then
j=`echo "$i"|cut -c5-`
mv $i $j
fi
done
... (5 Replies)
Discussion started by: Korn0474
5 Replies
5. Shell Programming and Scripting
Dear Friends,
I have a very little knowledge on shell scripting. I am stuck with a problem for which I need an expert advice.
I have a .txt file "image_urls.txt" which contains the data like this
imageurl ... (2 Replies)
Discussion started by: Praveen Pandit
2 Replies
6. Shell Programming and Scripting
Hi,
I want to read file multiple times. Right now i am using while loop but that is not working.
ex.
While read line
do
while read line2
do
echo stmt1
#processing some data based on data.,
done < file2.txt
done < file1.txt # This will have 10... (4 Replies)
Discussion started by: tmalik79
4 Replies
7. Shell Programming and Scripting
I have files in the ABC_YYYYMMDD.zip format under a directory. Each zip file contains A text file in the ABC_YYYYMMDD.txt format.
I am trying to create a script that will Rename the zip files and their underlying text file replacing the datepart in them with .
For eg: in the case of... (1 Reply)
Discussion started by: bash987
1 Replies
8. Shell Programming and Scripting
I have a specific set (all ending with .bam) of downloaded files in a directory /home/cmccabe/Desktop/NGS/API/2-15-2016. What I am trying to do is use a match to $2 in name to rename the downloaded files. To make things a more involved the date of the folder is unique and in the header of name... (1 Reply)
Discussion started by: cmccabe
1 Replies
9. Shell Programming and Scripting
I am trying to use sed to rename all .txt files in /home/cmccabe/test. However, I am getting an error that I seems to be putting the files in a new directory s, instead of in the original. Thank you :).
bash
# rename classified
cd /home/cmccabe/test
pattern2_old="_classify"... (2 Replies)
Discussion started by: cmccabe
2 Replies
10. Shell Programming and Scripting
In the below bash I am trying to copy the only text file (always only one) in /home/cmccabe/Desktop/list/QC/metrics.txt and rename each of the 3 text files according to /home/cmccabe/Desktop/test/list.txt using lines 3, 4 ,5. This format (that is list.txt) is always 5 lines. Thank you :).
... (12 Replies)
Discussion started by: cmccabe
12 Replies