Sponsored Content
Top Forums Shell Programming and Scripting How to rename the extension of a file? Post 302785651 by balajesuri on Tuesday 26th of March 2013 05:52:42 AM
Old 03-26-2013
With a modern shell:
Code:
file_name="rscclog_2013-03-25.txt;3"
mv $file_name ${file_name%;*}

This User Gave Thanks to balajesuri For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Recursicely search and rename file extension

Greetings to all!!:b: I have one root folder containing several other folders inside it. This tree structure is deep. And the files are of similar extension. I need to start at the top level and recursively search and rename all the files with say .a extension to .b . This is the code to... (7 Replies)
Discussion started by: riverside
7 Replies

2. Shell Programming and Scripting

rename file extension

I am trying for loop to rename file extension from .txt to .html : as below : for i in *.txt; do mv "$i" `basename $i`.html; done ------------------------------------------- But this renames a file file1.txt as file1.txt.html anyone know how get avoid .html added after .txt ? it... (4 Replies)
Discussion started by: sriram003
4 Replies

3. UNIX for Dummies Questions & Answers

Shell script to rename or change file extension case.

I searched the forum, but there was different type of rename. Hello. I have files in folder. Like: xxxxxxxx1.html or xxxxxxxx2.txt or xxxxxxxx3.tar.gz and how to rename or change file extension case to xxxxxxxx1.htm or xxxxxxx2.TXT or (5 Replies)
Discussion started by: Sheldon
5 Replies

4. Shell Programming and Scripting

rename a file with new extension

Hi guys, i had many files like filename.20110520_20110519_050030 i have to rename the file by removint the last numerics .. i.e filename.dat i tried with cut command and removed the numerics but i'm not able to add .dat to the files. is there any command insted of cut command to... (1 Reply)
Discussion started by: apple2685
1 Replies

5. Shell Programming and Scripting

ksh command to rename all files with no extension

hi! i want to rename all files with no extension with the extension DAT. with this command ls |grep -v "\\." i can list files but i dont know how i am going to rename them.. so i tried FILE_LIST=ls |grep -v "\\." for TEST_FILE in ${FILE_LIST} do mv $TEST_FILE... (2 Replies)
Discussion started by: kouppoua
2 Replies

6. Shell Programming and Scripting

Rename file to uppercase except extension

Hi, I am trying to make all file in the directory uppercase but not their extension (ex: image.jpg becoming IMAGE.jpg) here is code i am trying. $ ls | while read file do name=${file%%.*} newfilename=$(echo $name | tr 'a-z' 'A-Z') mv $file $newfilename done any suggestions of... (4 Replies)
Discussion started by: johninweb
4 Replies

7. Shell Programming and Scripting

Rename all files (filename with spaces) to different extension

Hi, I have files with filenames as below. SGM Daily Sales Email-en-us-05312012.xlwa I want to rename it in .xls. I am writing a script to change this, as there can be multiple files in subfolders. I have the following script. #!/bin/ksh for oldfile in $(find... (1 Reply)
Discussion started by: mac4rfree
1 Replies

8. Shell Programming and Scripting

Rename file extension.

I have a list file that contains names of many files. I am reading one file name at a time using for loop Then I like to create one more list file but with the file extension changed to "ctl". Note: The file name can have any number of dots ".". But the extension after the last dot should be... (4 Replies)
Discussion started by: pinnacle
4 Replies

9. Shell Programming and Scripting

Rename except dot file extension

After reading the manual of the command rename I would like to apply it to a folder with a couple of files containing old style dots before the file-type, e.g. up.to.the.roof.avi. So I'd like to rename them without the dots in between. Therefore I tried it the following way rename -f -n ... (4 Replies)
Discussion started by: 1in10
4 Replies

10. Shell Programming and Scripting

Rename specific file extension in directory with match to another file in bash

I have a specific set (all ending with .bam) of downloaded files in a directory /home/cmccabe/Desktop/NGS/API/2-15-2016. What I am trying to do is use a match to $2 in name to rename the downloaded files. To make things a more involved the date of the folder is unique and in the header of name... (1 Reply)
Discussion started by: cmccabe
1 Replies
ECACCESS-FILE-MOVE(1p)					User Contributed Perl Documentation				    ECACCESS-FILE-MOVE(1p)

NAME
ecaccess-file-move - Move or Rename ECaccess Files SYNOPSIS
ecaccess-file-move -version|-help|-manual ecaccess-file-move [-debug] source-ecaccess-file target-ecaccess-file DESCRIPTION
Allow moving an ECaccess File. When the move occurs within the same ECaccess File System then it is a rename. When the move occurs across two different ECaccess File Systems then first a copy is done and then a delete of the original file is done (e.g. similar to ecaccess- file-copy ... -erase). The source-ecaccess-file and target-ecaccess-file are in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management" section of the "ecaccess" guide for more information on the ECaccess File System. ARGUMENTS
source-ecaccess-file The source ECaccess File name. target-ecaccess-file The target ECaccess File name. OPTIONS
-version Display version number and exits. -help Print a brief help message and exits. -manual Prints the manual page and exits. -debug Display the SOAP messages exchanged. EXAMPLES
ecaccess-file-move ec:test1.txt ec:test2.txt Rename the test1.txt file in the ECFS directory of the authenticated user in test2.txt. ecaccess-file-move ec:test1.txt home:test2.txt Copy the test1.txt file from the ECFS directory of the authenticated user to the test2.txt file in the $HOME directory of the authenticated user, then delete the test1.txt file from ECFS. SEE ALSO
ecaccess-file-delete, ecaccess-file-get, ecaccess-file-mget, ecaccess-file-modtime, ecaccess-file-mput, ecaccess-file-rmdir, ecaccess-file- copy, ecaccess-file-dir, ecaccess-file-mdelete, ecaccess-file-mkdir, ecaccess-file-chmod, ecaccess-file-put, ecaccess-file-size and ecaccess. perl v5.14.2 2012-04-16 ECACCESS-FILE-MOVE(1p)
All times are GMT -4. The time now is 08:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy