Shell Script Help..Renaming Quoted files removing the timestamp
Hi all,
i am new to this forum, unix and shell scripting.
I would really appreciate if you all can help me here..
I have files coming in the below format
filename are characters..
like 'ABDDUT20513'13May06:03:45
i need it to be renamed as 'ABDDUT20513'
i tried
but its not working..
Help will be very much appreciated...
Thanks & Regards,
khman
Moderator's Comments:
As noted in later posts, it is not clear from the text provided by the original poster whether or not the single quotes are literal characters in the mentioned filenames. The single quotes provided by the OP have been preserved when CODE and ICODE tags were added.
Last edited by Don Cragun; 11-04-2015 at 11:14 PM..
Reason: Add CODE and ICODE tags.
Are you sure those single quotes are part of the file name? If not, and with a recent shell, try (untested)
with FN a shell variable holding the file name.
Thanks all for the reply & sorry for not using the code tags...
excuse me as I am just a beginner right now..
However, i feel it doesnt work..
i will explain in more detail...
i first find the files by the date, lets say 13May in a particular directory and uncompress them
Then I change the permission
After this Step, lets say I get a file as
. This is value which i see in the runnnig the script in debug mode
This piece of code picks up the file
file name can be anything but format will be the same as above.
now dynamically i need to rename whatever file comes
so for e.g. if it is
Then output has to be
Another example: Lets say file name is 'ABCCDT20515'15May05:17:38.Z
Then expected output is
.
This renamed file has to be placed in the same directory then.
Kindly help.
I really appreciate your replies and kindly bear with me.
I am just in learning stages of Shell scripting
Last edited by khman; 11-05-2015 at 11:03 AM..
Reason: Forgot to add something & Add code tags
Hi,
I am trying to removing the old files which were older than 10 days and same g zipping the files using the shell script.
script was return as follows.
find /jboss7_homes/JBOSS7/SKYLIV??/SKYLIV??_CRM/jboss-eap-7.0/standalone/log -mtime +10 -type f | xargs rm -f
find /cer_skyliv??/log... (6 Replies)
Hey guys,
ive been working on this for about 2hrs now - without any solution.
At first I need to say I dont have skills in linux bash scripting, but I tried to use some codesnippets and manuals from google.
What I want to do:
I have different folders including 2 different filestypes with... (15 Replies)
Hi
I would like to rename Multiple files in a Unix Directory using Ksh Command.
Eg ATT8-2011-10-01 00:00:00-MSA-IMM-SINGLE_AND_FAMILY_COVERAGE-DED-$2000-X114817.PDF
needs to be renamed as
ATT8-2011-10-01-MSA-IMM-SINGLE_AND_FAMILY_COVERAGE-DED-$2000-X114817.PDF
Basically the time... (2 Replies)
I have some 50+ files in the following format :
abcd_vish_running_ZEBRA_20140818.dat_08-14-2014_23:08:23
abcd_vish_running_ZEB-RA_20140818.dat_08-14-2014_23:08:35
abcd_vish_running_ZEB_RA_20140818.dat_08-14-2014_23:08:37
abcd_vish_running_RI-NG_20140818.dat_08-14-2014_23:08:42... (5 Replies)
Hey guys,
I'm really new to UNIX and shell scripting in general. For my internship I need to rename a bunch of files. Specifically, I need to change the first letter of each of the files to lowercase and I have to change the endings so they all basically look like "file_cone.jpg". I know I... (4 Replies)
Hi.
I need help with a little script that will be used to move some files to their parent directory, delete the directory, rename one file in the parent directory and delete another, then continue to the next.
Here's an example:
/var/media/Music/Genesis/1970 album - Trespass (2008 Box -... (4 Replies)
Hello
i have the files in this format
pdb1i0t.ent
pdb1lv7.ent
pdb1pp6.ent
pdb1tj2.ent
pdb1xg2.ent
pdb2b4b.ent
pdb2ewe.ent
Now i have to remove the prefix pdb from all the files and also i need to change the extension of .ent to .txt
The new file should look like this
... (3 Replies)
Hi Gurus,
I have some files(all ending with .out as extension).
Ex:
aa1.out
aa2.out
aa3.out
I would like to append each file with the current date to the end of the file so that they should become aa1_20090504.out.
So I am using rename as follows:
for i in path/aa* ; do mv $i... (5 Replies)
Hi,
I have a problem.
I have some text files in a folder. The names can be like:
emp.txt
emp1.txt
emp3.txt
32emp4.txt
What i need is i have to copy all the files which have "emp" string in their filename
to a different folder and those file names... (7 Replies)