Help with UNIX Shell Scripts
What if I had many files but needed to change the extensions of them and they all have different extensions.
For example, I need an sed command to change the file "batman.CPP" to be "batman.cpp" And I also have a file "kingsandqueens.dat" and I need it to be "kingsandqueens.backup" I need a shell script that will do this for me if I were to execute the program as ./chExt1.sh 'cpp' 'batman.CPP' or ./chExt1.sh 'backup' 'kingsandqueens.dat' Thanks for any help with this. |
Maybe you should have paid attention in the class this homework is for ...
|
I did pay attention. This is the last assignment. I didn't ask for the answer, just "any help" because I am struggling with how to get started.
|
post what you have so far
also for changing CAP to lower case there are small shell scripts already posted all over the net almost EVERY tutorial site would have something a simple " for i in *; do mv "$i"........... " |
I just need an sed command that rewrites a file to a different file extension
|
Quote:
|
man sed
|
Not sure why you would use sed at all. As suggested a simple loop and the mv command would be enough or if your distro has it have a look for the rename command.
|
All times are GMT -5. The time now is 10:59 PM. |