[Klug-general] Space to underscore?

Kevin Groves kgroves at ksoft-electrical-projects.co.uk
Tue May 15 12:41:16 UTC 2012


Or more old fashioned hacking if its a one off is to do an ls -R to get 
the dir tree, redirect to a text file.

Edit the text file with a search and replace on each line to prefix it 
with 'mv' and run the script letting it rename the files one by one.

Sometimes I would do this kind of thing with something like this AWK 
script (one of my fav tools):

{
print "mv '"$0"' " gsub(" ", "_", $0);
}


On 14/05/12 23:04, sharon kimble wrote:
> This is probably quite easy if you already know the answer, but I'm not very
> good at scripting.What I'm looking for is a script to go through my
> /home/foo/Music directory converting all the album titles with spaces in to
> convert them to underscores.
>
> Can anyone help please?
>
> Thanks
> Sharon.



More information about the Kent mailing list