Present Location: News >> Blog >> I love zsh

Blog

> I love zsh
Posted by prox, from Charlotte, on August 15, 2009 at 22:57 local (server) time

Can't do this in bash:

(dax:22:02)% pwd
/usr/local/www/apache22/www.prolixium.com
(dax:22:02)% cd com net
/usr/local/www/apache22/www.prolixium.net

Say I have tons of MP4 files.  Some have a suffix of "(iTouch).mp4" but most don't.  Here's how I list the ones without the iTouch:

% setopt extended_glob
% ls *.mp4~*iTouch\).mp4
A Clockwork Orange.mp4
Babylon A.D..mp4
Get Smart.mp4

Maybe I want to remove all files with the "(iTouch).mp4" suffix to just ".mp4" without using Perl or mmv(1):

% autoload -U zmv
% ls *.mp4                              
A Clockwork Orange (iTouch).mp4  Get Smart (iTouch).mp4
Babylon A.D. (iTouch).mp4
% zmv '*(iTouch)*' '$f:s/ (iTouch)//' 
% ls *.mp4                           
A Clockwork Orange.mp4  Babylon A.D..mp4  Get Smart.mp4

Just a few things that saved me some time, tonight.

> Add Comment

New comments are currently disabled for this entry.