Results 1 to 5 of 5

Thread: find and delete all underscores and/or text on multiple files

  1. #1
    Join Date
    Jan 2013
    Beans
    29

    find and delete all underscores and/or text on multiple files

    after looking multiple threads about renaming multiple files I messed up trying to leave only numbers on files, my result is this Screenshot from 2013-03-02 13:13:20.jpg I want to keep th first set of numbers


    forget it
    Last edited by Froylan; March 2nd, 2013 at 08:25 PM.

  2. #2
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    6,777
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: find and delete all underscores and/or text on multiple files

    Hi Froylan.

    Try this:
    Code:
    rename -nv 's/[^0-9]*([0-9]+)[^0-9].*/$1.mp4/' *
    That is a verbose dry run. Try it and when you see that it does what you want, remove the 'n' on the options.

    Hope it helps. Let us know how it goes.
    Regards.

  3. #3
    Join Date
    Jan 2013
    Beans
    29

    Re: find and delete all underscores and/or text on multiple files

    it said it changed the files to the perspective numbers and the mp4 extencion but it did not apear in the folder I did the command on, and also didn't appear in the home folder since i searched for it there

  4. #4
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    6,777
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: find and delete all underscores and/or text on multiple files

    Remove the dry run option: -n:
    Code:
    rename -v 's/[^0-9]*([0-9]+)[^0-9].*/$1.mp4/' *
    Regards.

    EDIT: "dry run" means show the output as if it were running the command, but it actually does nothing. That is, for test purposes.
    Last edited by papibe; March 2nd, 2013 at 09:28 PM.

  5. #5
    Join Date
    Jan 2013
    Beans
    29

    Re: find and delete all underscores and/or text on multiple files

    Quote Originally Posted by papibe View Post
    Remove the dry run option: -n:
    Code:
    rename -v 's/[^0-9]*([0-9]+)[^0-9].*/$1.mp4/' *
    Regards.

    EDIT: "dry run" means show the output as if it were running the command, but it actually does nothing. That is, for test purposes.
    thank you! sorry for being stupid; not understanding your command for if it does the trick, but it did what I want

Bookmarks

Posting Permissions

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