Sponsored Content
Top Forums Shell Programming and Scripting mv command to rename multiple files that retain some portion of the original file nam Post 302270268 by grimace15 on Saturday 20th of December 2008 02:03:19 PM
Old 12-20-2008
mv command to rename multiple files that retain some portion of the original file nam

Well the title is not too good, so I will explain.

I need to move (rename) files using a simple AIX script.

???file1.txt
???file2.txt
???file1a.txt
???file2a.txt

to be:

???renamedfile1'date'.txt
???renamedfile2'date'.txt
???renamedfile1a'date'.txt
???renamedfile2a'date'.txt

The ??? are realy numbers 001 through 999, and there are two filenames per number. The 'date' is easy `date +%Y%m%d`. but due to my limited scripting ability, I cannot seem to get this accomplished.

Any help would be greatly appreciated.

Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rename a file if I don't know its exact original name?

Hi everyone, I will be downloading a file every day with the name in this format SCA20060303_17514_IN.TXT And I need to rename it to SCA20060303_IN.TXT Where "20060303" is the current date, and the "_17514" part will always be a 5-digit number that I will NOT know beforehand. I... (9 Replies)
Discussion started by: propel
9 Replies

2. UNIX for Advanced & Expert Users

command to copy files with original ownership

Hi, I need a command that to copy files from others and to keep files' ownership. Example: I copy file.txt from users "abc" to my local, and file.txt is own by user "abc" in local. Thanks in advance! (3 Replies)
Discussion started by: need_help
3 Replies

3. Shell Programming and Scripting

how to rename multiple files with a single command

Hi I have following list of files at a path: 01.AR.asset 01.AR.index 01.AR.asset.vf 01.AR.asset.xv I want to rename all these files as follows: 73.AR.asset.Z 73.AR.index.Z 73.AR.asset.vf.Z 73.AR.asset.xv.Z Can any body give me a single command to acheive the above results. ... (5 Replies)
Discussion started by: tayyabq8
5 Replies

4. Shell Programming and Scripting

Multiple file rename (change in filename in unix with single command

Dear All, Please help ! i ham having 300 file with E.G. PMC1_4567.arc in seq. like PMC1_4568.arc,PMC1_4569.arc ...n and so on.. i want all those file to be rename like PMC_4567.arc ,PMC_4568.arc .. mean i want to remove 1 from first file name .. pls help.. (6 Replies)
Discussion started by: moon_22
6 Replies

5. UNIX for Dummies Questions & Answers

For Loop To Rename Multiple Files Finds One Non-existant File

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

6. Shell Programming and Scripting

Rename portion of file based on another file

Hello, I've been searching and reading, but I can't figure out how to solve this problem with my newbie skills. In my directory, I have a list of files (see dirlist.txt attachment) that I need to merge and rename. I have part of the code of the code figured out (see below). However, I... (3 Replies)
Discussion started by: anjulka
3 Replies

7. Shell Programming and Scripting

AWK print and retain original format

I have a file with very specific column spacing formatting, I wish to do the following: awk '{print $1, $2, $3, $4, $5, $6, $19-$7, $20-$8, $21-$9, $10, $11, $12}' merge.pdb > vector.pdb but the format gets ruined. I have tried with print -f but to no avail.... (7 Replies)
Discussion started by: chrisjorg
7 Replies

8. Shell Programming and Scripting

command to copy original files from links in HP-UX

I have folder ABC and files in ABC are links. I want to create the same ABC folder in different path and copy the actual files from source ABC dir. Can anyone provide command for this? Thanks in advance. (2 Replies)
Discussion started by: venkatababu
2 Replies

9. Shell Programming and Scripting

Renaming portion of multiple files

Hi, I have some files as below. Temp6001_5025.cpp Temp6002_5025.cpp Temp6003_5025.cpp Temp6004_5025.cpp Temp6005_5025.cpp Temp6006_5025.cpp Temp6007_5025.cpp . . Temp6100_5025.cpp i want to replace 5025 to 5026 in all files and the result should be Temp6001_5026.cpp . .... (3 Replies)
Discussion started by: lathigara
3 Replies

10. Shell Programming and Scripting

Bash to rename portion of file using match to another

In the portion of bash below I am using rename to match the $id variable to $file and when a match (there will alwsys be one) is found then the $id is removed from each bam and bam.bai in $file and _test is added to thee file name before the extension. Each of the variables is set correctly but... (3 Replies)
Discussion started by: cmccabe
3 Replies
X2SYS_MERGE(1gmt)					       Generic Mapping Tools						 X2SYS_MERGE(1gmt)

NAME
x2sys_merge - Merge an updated COEs tables SYNOPSIS
x2sys_merge -Amain_COElist.d -Mnew_COElist.d DESCRIPTION
x2sys_merge will read two crossovers data base and output the contents of the main one updated with the COEs in the second one. The second file should only contain updated COEs relatively to the first one. That is, it MUST NOT contain any new two tracks intersections (This point is NOT checked in the code). This program is useful when, for any good reason like file editing NAV correction or whatever, one had to recompute only the COEs between the edited files and the rest of the database. -A Specify the file main_COElist.d with the main crossover error data base. -M Specify the file new_COElist.d with the newly computed crossover error data base. OPTIONS
No space between the option flag and the associated arguments. EXAMPLES To update the main COE_data.txt with the new COEs estimations saved in the smaller COE_fresh.txt, try x2sys_merge -ACOE_data.txt -MCOE_fresh.txt > COE_updated.txt SEE ALSO
x2sys_binlist(1), x2sys_cross(1), x2sys_datalist(1), x2sys_get(1), x2sys_init(1), x2sys_list(1), x2sys_put(1), x2sys_report(1) GMT 4.5.7 15 Jul 2011 X2SYS_MERGE(1gmt)
All times are GMT -4. The time now is 04:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy