News for hackers. Stuff that matters.
Re:A Unix Utility You Should Know About: Pipe Viewer by jsrn on Monday February 02, 2009 @09:42AM (#462312)
mmv (moves multiple files based on a simple pattern replacement language). Example:

    mmv "*.mp3" "old_#1.mp3"
prefixes all files in the current directory ending with .mp3 with 'old_'. Btw., the quotes around the arguments are necesssary because mmv uses some of the same metacharacters as the shell does.

Multiple substitutions are allowed, e.g.:

    $ mmv "*.*" "#1___#2"
renames blub.xyz to blub___xyz.
Re:A Unix Utility You Should Know About: Pipe Viewer by jarekr on Tuesday February 03, 2009 @03:09AM (#463692)
Zsh has a module called zmv which lets you do things like:

zmv '(??)-(*).mp3' '$1 - ${(C)2:gs/_/ }.mp3'

Which would change "01-foo_bar_baz.mp3" into "01 - Foo Bar Baz.mp3"

Re:A Unix Utility You Should Know About: Pipe Viewer by nuclear_eclipse on Monday February 02, 2009 @12:18PM (#462537)
I've been looking for something like that for years!
Re:A Unix Utility You Should Know About: Pipe Viewer by moe on Monday February 02, 2009 @12:54PM (#462599)
I commonly use qmv (from renameutils):

qmv, qcp - Rename or copy files quickly, editing the file names in a text editor

Found nothing better for bulk renames because you get to use all the pattern/replace power of your favorite editor instead of learning some wierd specialized grammar through trial & error.

This is how to remove all spaces from mp3 filenames using vim:

qmv -f do *.mp3

:%s/ /_/g

:wq

Re:A Unix Utility You Should Know About: Pipe Viewer by jsrn on Monday February 02, 2009 @01:00PM (#462610)
for Emacs users, there is wdired mode, which makes a directory listing editable just like a normal Emacs buffer.
Re:A Unix Utility You Should Know About: Pipe Viewer by yters on Monday February 02, 2009 @05:42PM (#463058)
A lot of what I find lacking in a standard terminal, Emacs makes up for with its shell and terminal emulators. I find that an editable buffer with the contents of my entire session to be eminently powerful when combined with keyboard macros and the search/replace commands.
Re:A Unix Utility You Should Know About: Pipe Viewer by puffythefish on Monday February 02, 2009 @07:13PM (#463200)
Has anyone had any luck getting this to compile for OS X (Leopard)? make seems to fail on an error for me.
Re:A Unix Utility You Should Know About: Pipe Viewer by mark_h on Monday February 02, 2009 @03:37PM (#462833)
Andrew Myers has a shell script called mvsed that does something similar, using sed to specify the patterns.

Found it: http://www.cs.cornell.edu/andru/useful.html

Re:A Unix Utility You Should Know About: Pipe Viewer by Erwin on Monday February 02, 2009 @03:57PM (#462862)
There's a 'rename' script that comes with Perl that also does this, which may be useful if you want some really fancy renames. E.g. rename '$_=lc' *.MP3 to change case to lowercase.
Re:A Unix Utility You Should Know About: Pipe Viewer by nickb on Monday February 02, 2009 @03:40PM (#462839)
Anyone know where to find a source tarball that compiles under Leopard? All I've found is a bunch of precompiled Linux RPMs...
Re:A Unix Utility You Should Know About: Pipe Viewer by ruby_roo on Monday February 02, 2009 @06:57PM (#463175)
Update your MacPorts. It was just added:

http://trac.macports.org/changeset/46335

Re:A Unix Utility You Should Know About: Pipe Viewer by jsrn on Monday February 02, 2009 @05:41PM (#463056)
hm - no source tarball, but perhaps others find this Leopard binary useful:

http://www.joel.lopes-da-silva.com/articles/computer-science...

(including man pages etc.) Caveat: I didn't try it myself (I don't have Leopard).