Skip to content

Instantly share code, notes, and snippets.

@dotwaffle
Created December 4, 2013 15:49
Show Gist options
  • Save dotwaffle/7789870 to your computer and use it in GitHub Desktop.
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.
#!/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