Alter file name

Discussion in 'Mac Programming' started by dukebound85, Jun 12, 2012.

  1. macrumors P6

    dukebound85

    Joined:
    Jul 17, 2005
    Location:
    5045 feet above sea level
    #1
    How would one go about changing

    v_2011-07-21.grib 2

    to

    v_2011-07-21.grib


    I have thousands of files this way and hard time manipulating them in NCL as *.grib will not process the files with the 2

    Thanks for any help!
     
  2. macrumors 603

    Joined:
    Aug 9, 2009
    #2
    I don't know what NCL is.


    This shell pattern:
    Code:
    *.grib*
    
    will match filenames with or without a trailing " 2".

    It will also match other filenames, such as:
    Code:
    Dale.gribble.txt
    

    To change a bunch of filenames, you should first identify what a safe new filename is. Is simply stripping the " 2" safe?

    Automator.app has a number of file-renaming capabilities. Start there.

    Then you might look into two utilities: A Better Finder Rename, and NameChanger. There are others, google search terms: mac os x batch file rename
     
  3. macrumors member

    Joined:
    Aug 28, 2008
    #3
    Code:
    sed s/\ 2$//g
     

Share This Page