Shell Scripts (Renaming file names with sequential numbers)
Hi there,
Firstly, I have no experience with shell scripts so would really appreciate some help.
I have the following shell script that is causing some problems:
The problem is, the current setup is causing problems when we have duplicate archiving retrievals, as I can see the log file being written does not allow duplicate entries with the same. I need to change this by creating a sequential number and renaming the file with say _1, then the next file can be called _2. This would enable us to retrieve an archiving period as many times as we need to without the errors.
I would propose to delete the first statement:
then I would place the command in the lower part of the code. However, I am unsure of any shell commands, I have written in bold below the logical explanation of what I want to achieve, if there's someone that can help with the code it would be greatly appreciated.
Last edited by Franklin52; 06-06-2011 at 07:15 AM..
Reason: Please use code tags
I am afraid I do not get hold of your code completely.
Given sample shell script with same kind of logice hope this should give you better understanding..
sample shell script which might help you.
Below are the list of files which I want to just rename by increamenting the numbers with already exist files.
Output will be
The code given by both should work and still Yep I shall advice you to go ahead with yazu format ...that should also work for the first file as well...
Hi, I have about 60 files in a directory and need to rename those files. For example the file names are
i_can_phone_yymmdd.txt (where yymmdd is the date. i.e 170420 etc)
i_usa_phone_1_yymmdd.txt
i_eng_phone_4_yymmdd.txt
The new file names should be
phone.txt
phone_1.txt
phone_4.txt
I am... (4 Replies)
Hi Team,
I'm new to Unix shell scripting .
I've the following requirement
A folder contains the list of files with the following format
ab.name.11.first
ab.name.12.second
ab.name.13.third
----------
I have to rename the above file to like below
... (6 Replies)
Hi All,
I am looking for a simple way to write numbers to a file sequentially starting from 1 and ending on a specified upper limit. Example of the output file is below
Example
1
2
3
4
5
.
.
.
.
1000
please let me know the best way to do it. (10 Replies)
Hi Guys,
I have a small problem of renaming multiple files. For example I have names of a set of files in one directory like
K2_34625-34675
K7_988963-988983
K12_773882-7734102
and the other set corresponding to the same is
U_P_321_9_3_11.ab1
U_P_322_9_3_11.ab1
U_P_323_9_3_11.ab1
Now... (23 Replies)
I have 7 files with 7 different names coming into a specified folder on weekly basis, i need to pick a file one after another and load into oracle table using sql loader. I am using ksh to do this. So in the process if the file has error records and if sql loader fails to load into oracle tables,... (2 Replies)
I want to write a shell script that will rename all the file names to today's date attached to it..
so for example i have a file names like
file1.sales.20081201.txt.c
zbrs.salestxtn.20091101.txt.inn
then it will rename both the files with todays date to it so the file names get changed... (1 Reply)
So, I've got a ton of files that I want to go through (ie something like 300,000), and they're all labeled sequentially. However I'm not 100% positive that they are all there.
Is there any way of running through a sequence of numbers, checking if the file is in the folder, if not appending it... (2 Replies)
Hi,
How to separate numbers and words(with full alphabets) in a particular file and store it in two different files.
Please help me out for this.Using shell scripting.
:confused::confused: (1 Reply)
We have to convert a sequential file to a 80 char line sequential file (HP UX platform).The sequential file contains special characters. which after conversion of the file to line sequential are getting coverted into "new line" or "tab" and file is getting distorted. Is there any way to read these... (2 Replies)
Hi Unix gurus,
I have a file. I need to insert sequential number at the starting of the file. Fields are delimited by "|". I know the starting number.
Example:
File is as follows
|123|4test|test
|121|2test|test
|x12|1test|test
|vd123|5test|test
starting number is : 120
... (7 Replies)