Tuesday, February 10, 2009

White-space removal goodness with Linux

I've been recently putting together a massive backup of all my digital wares on my network. Problem is, over the years, when I've converted any CD I had over to digital mp3's or made a copy of one of my DVDs, a lot of it was done without a lot of thought that I'd be backing it up to a UNIX box 9-10 years down the road; so a lot of the filenames by pure convenience to the application(s) I was using, uses white-spaces as delineations between fields on a filename.

Is that a real problem? Kinda because white-spaced named files are a hooker to work with under *NIX platforms. Case in point, it does cost me some sleep at night.

So where does Adam go when there's no where else to turn? the *NIX command-line.


sed example: sed -n "s/\s/_/g"



tr example: tr [:space:] _


...quick and dirty solution.

No comments: