Hacker News new | ask | show | jobs
by aethertap 4238 days ago
I have one more that I like. I call it 'rex' and it basically allows me to do a regex substitution on command line text (not stdin, but actual command line args). It mostly comes in handy when looping over files in a directory where I want to do some kind of processing based on information in the file name. For example, I can tag all of the episodes of a podcast with their track numbers (several podcasts I listen to don't do id3tags) with this command:

    for f in *.mp3; 
      do id3v2 -T `rex 's/^[^0-9]*([0-9]+).*\.mp3$/\1/` $f; 
    done
The script itself is really simple, but I can post the source if anybody's interested.