Skip to content

Instantly share code, notes, and snippets.

@consoleSkunk
Last active May 3, 2022 16:02
Show Gist options
  • Save consoleSkunk/61b6678d6ff8d36ccb61fba8cfb2c52e to your computer and use it in GitHub Desktop.
Save consoleSkunk/61b6678d6ff8d36ccb61fba8cfb2c52e to your computer and use it in GitHub Desktop.
Bash script to extract Brickadia chat from game log files; for the Linux version of the game.
#!/bin/bash
# edit this if the brickadia directory is not in its default location
BRICKADIA_DIR=$HOME/.config/Epic/Brickadia/Saved
# path to save chatlogs to
CHATLOG_FOLDER=$BRICKADIA_DIR/ChatLogs
# make sure that the ChatLogs folder exists
[ ! -d $CHATLOG_FOLDER ] && mkdir -p $CHATLOG_FOLDER
# extract LogChat messages from all existing log files
for f in $BRICKADIA_DIR/Logs/Brickadia.log $BRICKADIA_DIR/Logs/Brickadia-backup-*.log $BRICKADIA_DIR/Crashes/*/Brickadia.log; do
# if file doesn't actually exist, skip it
[ ! -f $f ] && continue
CHATLOG_FILE=$CHATLOG_FOLDER/Brickadia-Chat-$(date -r $f '+%Y.%m.%d-%H.%M.%S').log
# only save if the chatlog file doesn't already exist
if [ ! -f $CHATLOG_FILE ]; then
# skip logs that don't contain any chat
! grep -q 'LogChat: ' $f && continue
grep -R 'LogChat: ' $f > $CHATLOG_FILE
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment