Godaddy changed the naming scheme of their server logs again. I need some perl or something magic that will convert format A to format B. Doing this is bash is going to be painful so I'm hoping some of your perl or python ninjas out there could help me.
format A: ex20140425000001.log
format B: Wed, May 21, 2014.log
So for the example above, that date needs to be converted to this name: ex20140521000001.log
Thanks in advance!
EDIT: nevermind... forgot about date.
#!/bin/bash for i in *.log; do fixeddate="$(echo $i | sed -e 's/,//g' -e 's/^....//' -e 's/.log//')" useitdate="$(date -d "$fixeddate" +%Y%m%d%H%M%S)" newname="ex$useitdate.log" mv "$i" "$newname" done
Last edited by graysky (2014-06-07 09:41:59)