Created
December 4, 2013 15:49
-
-
Save dotwaffle/7789870 to your computer and use it in GitHub Desktop.
I'd done the following in weechat: /set logger.file.mask "%Y/%m/$plugin.$name.weechatlog" I was looking for a way of moving my old logs into this new format -- some of them were huge, and it was a pain backing them up. Having been asked on more than one occasion for a copy of the script I wrote to do this for me, I decided to publish it here. Tada.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# place in .weechat/logs and run it. | |
for file in *.weechatlog | |
do | |
while read line | |
do | |
if [[ ! -d ${line:0:4}/${line:5:2} ]] | |
then | |
mkdir -p ${line:0:4}/${line:5:2}/ | |
fi | |
echo "$line" >> ${line:0:4}/${line:5:2}/$file | |
done <$file | |
rm $file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment