Results 1 to 10 of 12
I have a directory with the following in it.
01 Bathtub.mp3 10 Who Am I (What's My Name)_.mp3
02 G Funk Intro.mp3 11 For All My Niggaz & *****es.mp3
03 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-22-2005 #1Just Joined!
- Join Date
- Sep 2005
- Posts
- 3
renaming multiple mp3 files
I have a directory with the following in it.
01 Bathtub.mp3 10 Who Am I (What's My Name)_.mp3
02 G Funk Intro.mp3 11 For All My Niggaz & *****es.mp3
03 Gin And Juice.mp3 12 Ain't No Fun.mp3
04 W Balls.mp3 13 Interlude 2.mp3
05 Tha Shiznit.mp3 14 Doggy Dogg World.mp3
06 Interlude 1.mp3 15 Interlude 3.mp3
07 Lodi Dodi.mp3 16 Gz And Hustlas.mp3
08 Murder Was The Case.mp3 17 Interlude 4.mp3
09 Serial Killa.mp3 18 Pump Pump.mp3
I want to remove the numbers at the beginning so it looks like this.
Bathtub.mp3
G Funk Intro.mp3
Gin And Juice.mp3
W Balls.mp3
Tha Shiznit.mp3
Interlude 1.mp3
Lodi Dodi.mp3
Murder Was The Case.mp3
Serial Killa.mp3
Who Am I (What's My Name)_.mp3
For All My Niggaz & *****es.mp3
Ain't No Fun.mp3
Interlude 2.mp3
Doggy Dogg World.mp3
Interlude 3.mp3
Gz And Hustlas.mp3
Interlude 4.mp3
Pump Pump.mp3
I have tried this:
but I get this for the output. :Code:for i in *; do t=`echo $i |cut -d" " -f2,3,4,5,6,7,8,9` mv $i "$t"; done
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
I am assuming it is because of the spaces or special characters in the names. Can someone help me out.
TIA.
- 09-22-2005 #2Linux Engineer
- Join Date
- Mar 2005
- Posts
- 1,431
Make the script-line add quotes around the filenames.
- 09-22-2005 #3Just Joined!
- Join Date
- Sep 2005
- Posts
- 3
Tried this
#! /bin/sh
for i in *;
do t=`echo "$i" | cut -d" " -f2,3,4,5,6,7,8,9` mv "$i" "$t";
done
and am getting this now
mv: cannot move `01 Bathtub.mp3' to `': No such file or directory
mv: cannot move `02 G Funk Intro.mp3' to `': No such file or directory
... etc etc
Care to show me
?
- 09-22-2005 #4Linux Newbie
- Join Date
- May 2005
- Location
- Chennai,TamilNadu, India
- Posts
- 141
try this out it should work. I have tested it
Code:#! /bin/sh for i in * do t=$(echo $i | cut -f 2,3,4,5,6,7,8 -d ' ') mv "$i" "$t" done
- 09-23-2005 #5Just Joined!
- Join Date
- Sep 2005
- Posts
- 3
Awesome the above worked. THANKS! I have been trying to do that for so long
- 10-07-2005 #6Just Joined!
- Join Date
- Aug 2005
- Posts
- 3
hi
hi everyone,
these are my doubts
1)foo.c foo.c bar.c
foo.c foo.c bar.c
a) i want vi commnad to replace all occurneces of foo.c with bar.c
b)vi command to replace '.' with ' ; '
c)vi cmomand to display foobar,c at the end of every line
d)vi commnad to display bar.c at the beginning of every line
2)script to rename 1000 files in a direcotry from hello.c to hello.java
3)how can we do this ,using sed command if u want to replace the word hello.c to world in a file
4)what is daemon process and how is it created
kindly send me th replies as soon as possible
- 10-07-2005 #7Linux Engineer
- Join Date
- Mar 2005
- Posts
- 1,431
A daemon process is a process which runs in the background, for example sshd is a daemon waiting for SSH connections. Btw, you should start your own thread next time
- 10-07-2005 #8Linux Newbie
- Join Date
- May 2005
- Location
- Chennai,TamilNadu, India
- Posts
- 141
Looks to me this is a homework question?
Please have a go at these things urself before posting it. If u have any doubts in doing it then post it , u will get help
rather than directly stating
"send me the replies soon"
but i will give you hints to how to proceed with this, U can catch up on those and try
The sed command can be used to replace words like for example 'tiger' with 'lion':
where $ORIGINALFILE is the file u are going to edit and $TEMPFILE is the file you are going to store the edited information temporarily before you call the move commandCode:sed 's:tiger:lion:g' $ORIGINALFILE > $TEMPFILE mv $TEMPFILE $ORIGINALFILE
Different delimiters can be used. In my example i have used ':'. U can also use '/'
this link wil give u more information of how to use the sed command
http://www.shelldorado.com/newslette...000-2-Feb.html
Most of your questions can be answered by using sed command
- 10-08-2005 #9Just Joined!
- Join Date
- Aug 2005
- Posts
- 3
hi
hi friends,
thanks a lot for ur reply and information.i have to admit one thing that these are not home work questions , thses r interview questions asked by a mnc.i am layman in linux hence i posted these kind of sillly questions.awaiting reply for the remaining questions
bye
- 10-08-2005 #10Linux Engineer
- Join Date
- Nov 2004
- Location
- Ft. Polk, LA
- Posts
- 796
easytag is a good (gui) program for operating on music file names and tags.


Reply With Quote
