Sponsored Content
Top Forums UNIX for Dummies Questions & Answers rename multiple files from search output Post 302271251 by woodstock on Wednesday 24th of December 2008 11:48:49 AM
Old 12-24-2008
rename multiple files from search output

Variations of multiple renames seems to come up a lot but i can't find the answer to this situation.
Tidying up a directory where people rename files to .working, .bob, .attempt1 & so on.

what i am trying to do is: list the file type, & rename from ".whatever" to .fixed.
As the ".whatever" is rarely the same, it makes this a bit more than the normal rename all ".a's" to ".b's" if you get my drift.

For this particular list of example files i have come up with:

for i in `ls WLAN_* | egrep -v 'TRF|fixed' | cut -d "." -f1`;do mv $i.* $i.fixed;done

which appears to work fine but a tad "around the houses". I was hoping someone knew a better way/shorter command string.
Example files as follows:

1.sh
bla1.txt
bla2.csv
WLAN_20081128_00051453_01.TRF
WLAN_20081128_00051468_01.TRF
WLAN_20081128_00051469_01.TRF
WLAN_20081128_00051470_01.TRF
WLAN_clo_20081202_00051984_01.sg-working2
WLAN_clo_20081129_00051540_01.sg-working
WLAN_clo_20081129_00051580_01.sg-working
WLAN_clo_20081202_00052011_01.still_failed
WLAN_clo_20080923_00043115.done
WLAN_20081128_00051467_01.TRF
WLAN_20081128_00051466_01.TRF
WLAN_20081128_00051465_01.TRF
WLAN_20081128_00051454_01.TRF
WLAN_20081128_00051455_01.TRF
WLAN_20081128_00051456_01.TRF
WLAN_20081128_00051457_01.TRF
WLAN_20081128_00051458_01.TRF
WLAN_20081128_00051459_01.TRF
WLAN_20081128_00051460_01.TRF
WLAN_20081128_00051461_01.fixed
WLAN_20081128_00051462_01.fixed
WLAN_20081128_00051463_01.TRF
WLAN_20081128_00051464_01.TRF
WLAN_clo_20081222_00054519_01.test1-sg

Desired output ( but this was using my command as above)

1.sh
bla1.txt
bla2.csv
WLAN_20081128_00051453_01.TRF
WLAN_20081128_00051468_01.TRF
WLAN_20081128_00051469_01.TRF
WLAN_20081128_00051470_01.TRF
WLAN_clo_20081202_00052011_01.fixed
WLAN_clo_20081129_00051580_01.fixed
WLAN_clo_20081202_00051984_01.fixed
WLAN_clo_20081222_00054519_01.fixed
WLAN_clo_20080923_00043115.fixed
WLAN_20081128_00051467_01.TRF
WLAN_20081128_00051466_01.TRF
WLAN_20081128_00051465_01.TRF
WLAN_20081128_00051454_01.TRF
WLAN_20081128_00051455_01.TRF
WLAN_20081128_00051456_01.TRF
WLAN_20081128_00051457_01.TRF
WLAN_20081128_00051458_01.TRF
WLAN_20081128_00051459_01.TRF
WLAN_20081128_00051460_01.TRF
WLAN_20081128_00051461_01.fixed
WLAN_20081128_00051462_01.fixed
WLAN_20081128_00051463_01.TRF
WLAN_20081128_00051464_01.TRF
WLAN_clo_20081129_00051540_01.fixed

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Rename multiple files

Hello, I want to rename multiple files at a time and I don't know how to do it. I have various ".mp3" files, like "band name - music name.mp3" and I want to remove the "band name" from all files. Anybody knows how to do it using shell script or sed or even perl? Thanks (7 Replies)
Discussion started by: luiz_fer10
7 Replies

2. Shell Programming and Scripting

rename multiple files

Hi, can anyone have a ksh script to rename multiple files (ie to remove .Z extension of the files) can someone correct this? for i in *.Z do var1 = substr($i, 1,at(".Z",$i)-1) mv $i $var1 done Thanks.. Antony (13 Replies)
Discussion started by: antointoronto
13 Replies

3. Shell Programming and Scripting

now to rename multiple files

I have several hundred files in one directory which I need to move to another directory with the new extension, for example: /bb/data/rptmgr* are in the source directory need to be moved to /bb/data55/rptmgr*.new Is there an efficient way to do it? Thanks -A (4 Replies)
Discussion started by: aoussenko
4 Replies

4. UNIX for Dummies Questions & Answers

How to rename multiple files

Hi all, I have some files like: pickup.0000043200.t001.t001.data pickup.0000043200.t001.t002.data pickup.0000043200.t002.t001.data pickup.0000043200.t002.t002.data pickup.0000043200.t003.t001.data pickup.0000043200.t003.t002.data I need to rename these files to ... (4 Replies)
Discussion started by: a_dor8
4 Replies

5. Shell Programming and Scripting

Rename the multiple files

Hi I need to reanme the multiple file using unix script I have multiple file like: sample_YYYYMMDD.xls test new_YYYYMMDD.xls simple_YYYYMMDD.xls I need to rename this file sample.xls testnew.xls SIMPLE.xls thanks (8 Replies)
Discussion started by: murari83.ds
8 Replies

6. Shell Programming and Scripting

Using a single "find" cmd to search for multiple file types and output individual files

Hi All, I am new here but I have a scripting question that I can't seem to figure out with the "find" cmd. What I am trying to do is to only have to run a single find cmd parsing the directories and output the different file types to induvidual files and I have been running into problems.... (3 Replies)
Discussion started by: swaters
3 Replies

7. Shell Programming and Scripting

Script to unzip files and Rename the Output-files

Hi all, I have a many folders with zipped files in them. The zipped files are txt files from different folders. The txt files have the same names. If i try to find . -type f -name "*.zip" -exec cp -R {} /myhome/ZIP \; it fails since the ZIP files from different folders have the same names and... (2 Replies)
Discussion started by: pmkenya
2 Replies

8. UNIX for Dummies Questions & Answers

[Solved] Search, Extract and Rename Multiple Files

Hi, I want perl script for the below requirement. We have lot of files like below name in the directory 750464921-RE-file2.csv 750452173-RE-file1.csv 750385426-RE-file3.csv 750373470-RE-file4.csv And also we have another file as "Group.csv" in the same directory as per the below format... (9 Replies)
Discussion started by: armsaran
9 Replies

9. 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

10. 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
csyconv.f(3)							      LAPACK							      csyconv.f(3)

NAME
csyconv.f - SYNOPSIS
Functions/Subroutines subroutine csyconv (UPLO, WAY, N, A, LDA, IPIV, WORK, INFO) CSYCONV Function/Subroutine Documentation subroutine csyconv (characterUPLO, characterWAY, integerN, complex, dimension( lda, * )A, integerLDA, integer, dimension( * )IPIV, complex, dimension( * )WORK, integerINFO) CSYCONV Purpose: CSYCONV convert A given by TRF into L and D and vice-versa. Get Non-diag elements of D (returned in workspace) and apply or reverse permutation done in TRF. Parameters: UPLO UPLO is CHARACTER*1 Specifies whether the details of the factorization are stored as an upper or lower triangular matrix. = 'U': Upper triangular, form is A = U*D*U**T; = 'L': Lower triangular, form is A = L*D*L**T. WAY WAY is CHARACTER*1 = 'C': Convert = 'R': Revert N N is INTEGER The order of the matrix A. N >= 0. A A is COMPLEX array, dimension (LDA,N) The block diagonal matrix D and the multipliers used to obtain the factor U or L as computed by CSYTRF. LDA LDA is INTEGER The leading dimension of the array A. LDA >= max(1,N). IPIV IPIV is INTEGER array, dimension (N) Details of the interchanges and the block structure of D as determined by CSYTRF. WORK WORK is COMPLEX array, dimension (N) INFO INFO is INTEGER = 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value Author: Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd. Date: November 2011 Definition at line 113 of file csyconv.f. Author Generated automatically by Doxygen for LAPACK from the source code. Version 3.4.1 Sun May 26 2013 csyconv.f(3)
All times are GMT -4. The time now is 04:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy