Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    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.
    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:
    for i in *; do t=`echo $i |cut -d" " -f2,3,4,5,6,7,8,9` mv $i "$t"; done
    but I get this for the output. :
    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.


  2. #2
    Linux Engineer
    Join Date
    Mar 2005
    Make the script-line add quotes around the filenames.

  3. #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";

    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 ?

  4. $spacer_open
  5. #4
    Linux Newbie
    Join Date
    May 2005
    Chennai,TamilNadu, India
    try this out it should work. I have tested it

    #! /bin/sh
    for i in *
    t=$(echo $i | cut -f 2,3,4,5,6,7,8 -d ' ')
    mv "$i" "$t"

  6. #5
    Awesome the above worked. THANKS! I have been trying to do that for so long

  7. #6


    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

    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

  8. #7
    Linux Engineer
    Join Date
    Mar 2005
    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

  9. #8
    Linux Newbie
    Join Date
    May 2005
    Chennai,TamilNadu, India
    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':

    sed 's:tiger:lion:g' $ORIGINALFILE > $TEMPFILE
    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 command

    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

    Most of your questions can be answered by using sed command

  10. #9


    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


  11. #10
    Linux Engineer
    Join Date
    Nov 2004
    easytag is a good (gui) program for operating on music file names and tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts