Sponsored Content
Full Discussion: Rename file extension.
Top Forums Shell Programming and Scripting Rename file extension. Post 302774193 by pinnacle on Friday 1st of March 2013 11:18:02 AM
Old 03-01-2013
Quote:
Originally Posted by bipinajith
Use parameter substitution:
Code:
while read file
do
     echo "${file%.*}.ctl"
done < listfile.txt

Note: for i in `cat listfile.txt` is Dangerous Backticks

So use while loop instead as shown above.

This works could you please explain the below code

Code:
 echo "${file%.*}.ctl"

Not sure how this single line is doing great job.
 

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

How to rename the extension of a file?

Hello, I have multiple files named rscclog_2013-03-25.txt;3 in a directory, where 2013-03-25 is the previous day's date and the number after extension .txt preceded by a ';' is any number which i do not know beforehand. Now, i have to rename all such files as rscclog_2013-03-25.txt thus,... (2 Replies)
Discussion started by: rahulkt1987
2 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
ExtUtils::Mksymlists(3pm)				 Perl Programmers Reference Guide				 ExtUtils::Mksymlists(3pm)

NAME
ExtUtils::Mksymlists - write linker options files for dynamic extension SYNOPSIS
use ExtUtils::Mksymlists; Mksymlists({ NAME => $name , DL_VARS => [ $var1, $var2, $var3 ], DL_FUNCS => { $pkg1 => [ $func1, $func2 ], $pkg2 => [ $func3 ] }); DESCRIPTION
"ExtUtils::Mksymlists" produces files used by the linker under some OSs during the creation of shared libraries for dynamic extensions. It is normally called from a MakeMaker-generated Makefile when the extension is built. The linker option file is generated by calling the function "Mksymlists", which is exported by default from "ExtUtils::Mksymlists". It takes one argument, a list of key-value pairs, in which the following keys are recognized: DLBASE This item specifies the name by which the linker knows the extension, which may be different from the name of the extension itself (for instance, some linkers add an '_' to the name of the extension). If it is not specified, it is derived from the NAME attribute. It is presently used only by OS2 and Win32. DL_FUNCS This is identical to the DL_FUNCS attribute available via MakeMaker, from which it is usually taken. Its value is a reference to an associative array, in which each key is the name of a package, and each value is an a reference to an array of function names which should be exported by the extension. For instance, one might say "DL_FUNCS => { Homer::Iliad => [ qw(trojans greeks) ], Homer::Odyssey => [ qw(travellers family suitors) ] }". The function names should be identical to those in the XSUB code; "Mksymlists" will alter the names written to the linker option file to match the changes made by xsubpp. In addition, if none of the functions in a list begin with the string boot_, "Mksymlists" will add a bootstrap function for that package, just as xsubpp does. (If a boot_<pkg> function is present in the list, it is passed through unchanged.) If DL_FUNCS is not specified, it defaults to the bootstrap function for the extension specified in NAME. DL_VARS This is identical to the DL_VARS attribute available via MakeMaker, and, like DL_FUNCS, it is usually specified via MakeMaker. Its value is a reference to an array of variable names which should be exported by the extension. FILE This key can be used to specify the name of the linker option file (minus the OS-specific extension), if for some reason you do not want to use the default value, which is the last word of the NAME attribute (e.g. for "Tk::Canvas", FILE defaults to "Canvas"). FUNCLIST This provides an alternate means to specify function names to be exported from the extension. Its value is a reference to an array of function names to be exported by the extension. These names are passed through unaltered to the linker options file. Specifying a value for the FUNCLIST attribute suppresses automatic generation of the bootstrap function for the package. To still create the bootstrap name you have to specify the package name in the DL_FUNCS hash: Mksymlists({ NAME => $name , FUNCLIST => [ $func1, $func2 ], DL_FUNCS => { $pkg => [] } }); IMPORTS This attribute is used to specify names to be imported into the extension. It is currently only used by OS/2 and Win32. NAME This gives the name of the extension (e.g. "Tk::Canvas") for which the linker option file will be produced. When calling "Mksymlists", one should always specify the NAME attribute. In most cases, this is all that's necessary. In the case of unusual extensions, however, the other attributes can be used to provide additional information to the linker. AUTHOR
Charles Bailey <bailey@newman.upenn.edu> REVISION
Last revised 14-Feb-1996, for Perl 5.002. perl v5.16.2 2012-10-11 ExtUtils::Mksymlists(3pm)
All times are GMT -4. The time now is 04:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy