Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Rename multiple files in shell bash, changing elements order. Post 302903527 by Don Cragun on Wednesday 28th of May 2014 08:16:40 AM
Old 05-28-2014
Welcome to the UNIX and Linux Forums.

We don't need to close the thread. I have moved it from the Post Here to Contact Site Administrators and Moderators forum (which is intended for resolving site issues) to a technical forum intended to help with relatively simple shell scripting problems.

Please explain the rules that govern how files are to be renamed. For instance with your sample input, any of the following would work:
  1. Change "BH" to "0805." and change the 1st 5 characters to "20".
  2. Delete the 1st character of the name, move the next 4 characters after the 1st period in the name, change "BH" to ".", and add "20" to the start of the name.
  3. Change the 1st 5 characters of the name to "20" and change the last 3 characters of the name to "0805.N".
Give us a clear statement that identifies what files are to be processed and how the names are to be transformed and we'll be happy to help you find a way to do it.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Average of elements throught multiple files

Hi, I got a lot of files looking like this: 1 0.5 6 All together there are ard 1'000'000 lines in each of the ard 100 files. I want to build the average for every line, and write the result to a new file. The averaging should start at a specific line, here for example at line... (10 Replies)
Discussion started by: chillmaster
10 Replies

2. Shell Programming and Scripting

bash script to rename multiple directories

Hello I have a directory structure with year in format 4 digits, e.g 2009, below which is month format 1 or 2 digits, e.g 1 or 12, blow which is day format 1 or 2 digits, e.g 1 or 31. I want to change the names of lots of directories to the be Year - 4 digits , e.g 2009 - No change here... (4 Replies)
Discussion started by: garethsays
4 Replies

3. UNIX for Dummies Questions & Answers

help with multiple files rename...

Hi everyone, I'm very green in Linux. Please help me to solve my problem. I have thousands of files and I want to change their names. They have naming convection: prefix_date_date+1_suffix.nc prefix: ext-GLORY date_date+1: 20020101_20020102 and two types of suffix: gridV_R20020130 and... (3 Replies)
Discussion started by: makikicindy
3 Replies

4. Shell Programming and Scripting

Need help for a Shell script to rename multiple files

Hi! I need help to create a shell script to search inside a file and then copy a portion of the search result as the new file name. Basically I was hacked over the weekend and the genius wipe out my drive from my server. I was able to recover alot of files, but biggest problem Is now the... (15 Replies)
Discussion started by: kidney514
15 Replies

5. UNIX for Dummies Questions & Answers

Renaming files by changing date order

I'm looking for a simple solution to rename a batch of files. All of the files in this directory start with a date in the format mm.dd.yy followed by a space and then additional descriptive text. Example: 01.21.10 742 P.xlsx 02.24.09 730 Smith.xlsx The information following the date can... (3 Replies)
Discussion started by: kreisel
3 Replies

6. UNIX for Dummies Questions & Answers

Rename multiple files, changing prefix, extension and dropping characters

I'm currently only able to perform some very basic functions, so hope this makes sense... I have a set of about 27 files that need to be renamed from something like this: 000012ABCDEFGHIJ.XXX.YYY.ZZZ 000078KLMNO.XXX.YYY.ZZZ 000099PQ.XXX.YYY.ZZZ to something like this: newa012.abc... (11 Replies)
Discussion started by: bbmcg
11 Replies

7. Shell Programming and Scripting

Rename multiple files

Hi, In my directory I have many files, for e.g. file_123 file_124 file_125 file_126 file_127 Instead of renaming these files one by one, I would like to rename them at a same time using same command... they should appear like 123 124 125 126 127 What command(awk or ls or... (3 Replies)
Discussion started by: juzz4fun
3 Replies

8. Shell Programming and Scripting

How to rename multiple files at one go?

Hi, I have hundreds of files with XXX in their file name and I want to rename all of them with YYY in place of XXX. for ex: $ ls -1 123XXX789 345XXX678 Output $ ls -1 123YYY789 345YYY678 I know we can loop in each file and sed to replace and rename each file but ren *XXX* *YYY*... (4 Replies)
Discussion started by: reddyr
4 Replies

9. Shell Programming and Scripting

SBATCH trinity for multiple files and rename/move the output files

Hey guys, I have wrote the following script to apply a module named "trinity" on my files. (it takes two input files and spit a trinity.fasta as output) #!/bin/bash -l #SBATCH -p node #SBATCH -A <projectID> #SBATCH -n 16 #SBATCH -t 7-00:00:00 #SBATCH --mem=128GB #SBATCH --mail-type=ALL... (1 Reply)
Discussion started by: @man
1 Replies
brlapi_writeArguments_t(3)					      BrlAPI						brlapi_writeArguments_t(3)

NAME
brlapi_writeArguments_t - SYNOPSIS
#include <brlapi.h> Data Fields int displayNumber unsigned int regionBegin unsigned int regionSize char * text int textSize unsigned char * andMask unsigned char * orMask int cursor char * charset Detailed Description Structure containing arguments to be given to brlapi_write() Field Documentation unsigned char* brlapi_writeArguments_t::andMask And attributes; applied first char* brlapi_writeArguments_t::charset Text charset. NULL means it is assumed to be 8bits, and the same as the server's. '' means current locale's charset. If no locale was selected, defaults to NULL's meaning. int brlapi_writeArguments_t::cursor BRLAPI_CURSOR_LEAVE == don't touch, BRLAPI_CURSOR_OFF == turn off, 1 = 1st char of display, ... int brlapi_writeArguments_t::displayNumber Display number BRLAPI_DISPLAY_DEFAULT == unspecified unsigned char* brlapi_writeArguments_t::orMask Or attributes; applied after ANDing unsigned int brlapi_writeArguments_t::regionBegin Region of display to update, 1st character of display is 1 unsigned int brlapi_writeArguments_t::regionSize Number of characters held in text, andMask and orMask. char* brlapi_writeArguments_t::text Text to display, must hold as many characters as the region fields expresses. int brlapi_writeArguments_t::textSize Size of text in bytes. If -1, strlen() is used for computing it. Author Generated automatically by Doxygen for BrlAPI from the source code. Version 1.0 Fri Jun 7 2013 brlapi_writeArguments_t(3)
All times are GMT -4. The time now is 10:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy