Every so often I have files with spaces in their names and I want to rename them with underscores for the spaces. The way I have normally done the the renaming is by putting the output of an ls into a file and editing the file in vim
to make it into a script.
I usually do ":g/.*/s//mv & &/ " and then hand editing the paces to underscores in the third column.
There has to be a better way.
Is it possible to have vim do the substitution on the third column without affecting the first column? Actually as I think about it maybe a bash or ksh (after years of use ksh is still my preferred shell) script would be better. Maybe a "for f in *; do mv $f $g; done" but how do I get $g from $f with spaces substituted?

Thanks for any suggestions.
Alec Shaw

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to