[CLUE-Talk] Re: gensup, was: Re: [CLUE-Tech] removing spaces from filenames?

Dave Price davep at kinaole.org
Mon Nov 18 12:00:07 MST 2002


On Mon, Nov 18, 2002 at 11:13:53AM -0700, Jed S. Baer wrote:
> On Mon, 18 Nov 2002 11:05:01 -0700
> Dave Price <davep at kinaole.org> wrote:
> 
> > ls | awk '{print "mv " $1, gensub(" ","_",1,$1)}'
> 
> It's an awk native function. Um, depending upon which awk you're using, I
> guess. In addition to the original awk, there's nawk, gawk, and mawk.
> 
> $ ls -l `which awk`
> lrwxrwxrwx    1 root     root            4 Mar 23  2002 /bin/awk -> gawk
> 
> YMMV. You might try the gsub function instead.
> 
It runs w/out errors when I exec gawk explicitely - my
/etc/alternatives/awk was mawk - But the filename need to be protected
with quotes somehow - when I have a dir named 'Dir with Spaces' it tries
to 'mv Dir Dir' - also craps out on filenames like: (1)dj1-4.gif
(because of the parens?)

Still trying - I did find an mp3rename.pl which works nicely, but:

1> won't rename dirs (folders)
2> won't recurse (I just got a boatload of windows-ripped albums and I
need to merge them into my collection so that my shell scripts can play
them right)

aloha,
dave




More information about the clue-talk mailing list