GREP question

Discussion in 'Mac Apps and Mac App Store' started by harleytat, Mar 4, 2005.

  1. harleytat macrumors newbie

    Joined:
    Jul 22, 2002
    #1
    I'm using A Better Finder Rename to rename a bunch of files in this format: SampleFileName

    I'd like them to look like this: sample file name

    I've gotten this far in my grep adventures, which selects the first (capitalized) word: ([AB][a-z]*) but I can't figure out how to define the subsequent words.

    first one with the answer gets good karma!

    thanks a lot
    H
     
  2. martintyler macrumors newbie

    Joined:
    Feb 9, 2005
    #2
    Sorry, not a complete answer, but...

    echo "SampleFileName" | sed 's,\([A-Z]\)\([a-z]*\)\([A-Z]\)\([a-z]*\)\([A-Z]\)\([a-z]*\),\1\2 \3\4 \5\6,1'| tr 'A-Z' 'a-z'
    sample file name
     
  3. broken_keyboard macrumors 65816

    broken_keyboard

    Joined:
    Apr 19, 2004
    Location:
    Secret Moon base
    #3
    ls | perl -e 'while (<>) { chomp; $old = $_; s/([^A-Z])([A-Z])/$1 $2/g; $new = lc($_); `mv "$old" "$new"`}'
     
  4. AtlantaGuy macrumors member

    Joined:
    Jan 13, 2002
    Location:
    Atlanta, GA
  5. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #5
    Not an answer to your question..

    But I found that ABFR sucked. It didn't do what it advertised at all and the developers didn't do jack to help me try and correct it (I was trying to do something fairly simple afterall).

    Ultimately, I settled on Filenamer.
     
  6. harleytat thread starter macrumors newbie

    Joined:
    Jul 22, 2002
    #6
    genius

    broken keyboard...pure genius. you saved me mucho time. just tried it on a small batch and it worked flawlessly...now gonna toss it at the 1200 other files.

    thanks all else for the software recs. am downloading and checking them out as we speak.

    H
     

Share This Page