How to rename all the files in a folder having specific
extension?
Example: I have some files with extension (.txt) in a folder
name 'Test'. I have to rename all the .txt files in a test
and its subdirectories to .my extension.
Answer Posted / prav gir
#!/bin/sh
for filename in *$1*
do
echo "$filename"
mv -f "$filename" `echo $filename|sed "s/$1/$2/"`
done
run script like
$>scrpt1 .txt .my
| Is This Answer Correct ? | 3 Yes | 3 No |
Post New Answer View All Answers
Differentiate between ‘ and ” quotes.
How will you emulate wc –l using awk?
What is path variable bash?
What is the difference between grep and egrep?
What are types of shells?
Is shell a scripting language?
What is computer cli?
What is awk in shell script?
What is web script?
What is bourne shell scripting?
What are the four fundamental components of every file system on linux?
Hello all, This is my assignment on shell scripting, can anyone help me regarding this ? Create a shell script which connects to the database In second shell script include the first script for the DB connection Create a table (PRADEEP_DATA) with 2 columns (name, value) In Third shell script include the first script for the DB connection And insert/delete the values from the Table, by accepting input from the user This functionality should be a menu driven Program: 1) Insert to the database a. Name b. value 2)Delete from the database a.Name b.value Exception handling needs to be taken care.
Is shell scripting useful?
How do we delete all blank lines in a file?
What is the default shell of solaris?