Wi-Fizzle.com - Putting the fizzle in Wi-Fi since 2005 .. (yes, this was a poor choice for a domain name)

#361
This is why they pay me the big bucks..

Posted by dandriff on Friday May 22, 2009@08:09PM

I wanted to rename a bunch of Firefox session files, because they have been tugged along from Windows install to install, and the naming had gotten crazy and inconsistent. So I whipped this up:

Administrator@hammertime:/cygdrive/c/Documents and Settings/Administrator/Application Da
a/Mozilla/Firefox/Profiles/ev0zie8w.default/sessions$ export IFS="
"; for f in `ls -1 zPortofire--* | grep '^.*\([0-9-]\+\).*$'`; do mv "$f" "`echo
f | sed -e 's/^\(.*\)\(200[0-9-]\+\)\(.*\)$/\2 \1\3/g' | sed -e 's/zPortofire--/Portofire /g' | sed -e 's/_/ /g' | sed -e 's/ \+/ /g' | sed -e 's/--/-/g' | sed -e
s/[ -]\./\./g' | sed -e 's/Portofire - /Portofire /g'`"; done

I'm not saying that it is complicated once you break it down...but I don't know many other people IRL who can create these useful little command line scripts.

hmm.