Benutzer:Heernis/Nützliche Skripte

Aus EnzyklopAtys

Wechseln zu: Navigation, Suche
Chatlogfilter.png
#!/bin/bash
ID=0 #Profile ID
CHARNAME="heernis" #allways lowercase

SHOWNOT="(SYSTEM\|MTD)" #Skipped every system log and GuildMotd Message

#Uncomment only one line, if needed.
#SHOWONLY="[0-9] {put any dynchat}"
#SHOWONLY="[0-9] ryzomforge"
#SHOWONLY="[0-9] Deutsch Uni"
#SHOWONLY="[0-9] English Uni"
#SHOWONLY="[0-9] Karavan"
#SHOWONLY="[0-9] Kami"
#SHOWONLY="[0-9] Marauder"
#SHOWONLY="[0-9] Ranger"
#SHOWONLY=(UNIVERSE)
#SHOWONLY=(TELL) #Driect Message
#SHOWONLY=(SAY) #Around-Chat
#SHOWONLY=(GUILD)

#Uncomment only one line
#RMDATE="s/[0-9][0-9][0-9][0-9]\/[0-9][0-9]\/[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] //g" #remove date and time
RMDATE="s/[0-9][0-9][0-9][0-9]\/[0-9][0-9]\/[0-9][0-9] //g" #remove only date
#RMDATE="[0-9][0-9]:[0-9][0-9]:[0-9][0-9]//g" #remove only time

#Removes unecessary log rubbish
RMCOLOR="s/\@{[A-Z0-9]\+}//g; s/ \* //g" #remove * and @{EE3F}
RMGENERIC='/(CSR)/! s/([A-Z]\+)//g' #remove GENERIC CHANNEL INFO like (UNIVERSE) except (CSR)
RMDYN='s/(DYN[0-9])//g' #removes DYN CHANNEL INFO like (DYN0)
RMLANGUNI="s/\[[0-9] [A-Zaa-z]\+ [A-Zaa-z]\+\] //g" #removes UNI LANGUAGE INFO like (0 English UNI)
RMDYN1="s/\[[0-9] [A-Zaa-z]\+\] //g" #removes DYN INFO like [0 ryzomforge]
RMINFO="/<INFO>/d; /<USERS>/d"

TELLST="s/\/tellst//g; s/sagt dir/flüstert zurück/g" # german issue, removes "/tellst" and change answers to "flüstert zurück"

#RMSPACE="s/\(.\{1\}\)//" #Removes space at the beginning of every line, change the number if needed.

tail -f /home/$USER/.local/share/Ryzom/$ID/save/log_$CHARNAME.txt | grep --line-buffered -v "$SHOWNOT" | grep --line-buffered "$SHOWONLY" | sed -ue "$RMCOLOR;$RMGENERIC;$RMDYN;$RMDYN1;$RMLANGUNI;$RMINFO;$TELLST;$RMDATE;$RMSPACE"
#!/bin/bash
#Rewrite live chatlog and show in terminal (only ryzomforge)
tail -f ~/.local/share/Ryzom/0/save/log_heernis.txt | grep --line-buffered "[123456789] ryzomforge" | sed -u -e 's/\@{[A-Z0-9]\+}//g' | sed -u -e 's/ \* //g' | sed -u -e 's/\[//g;s/\]//g;' | sed -u -e 's/[1-9] ryzomforge//g' | sed -u -e 's/(DYN[1-9])//g' | sed -u '/<INFO>/d' | sed -u '/<USERS>/d' | sed -u -e 's/[0-9]\{4,\}\/[0-9]\{2,\}\/[0-9]\{2,\} [0-9]\{2,\}:[0-9]\{2,\}:[0-9]\{2,\}//g' | sed -u -e 's/\(.\{2\}\)//'
#!/bin/bash
#Rewrite chatlog for archiving into text-file (only ryzomforge)
grep "[123456789] ryzomforge" ~/.local/share/Ryzom/0/save/log_heernis.txt | sed -e 's/\@{[A-Z0-9]\+}//g' | sed -e 's/ \* //g' | sed -e 's/\[//g;s/\]//g;'  | sed -e 's/[1-9] ryzomforge//g' | sed -e 's/(DYN[1-9])//g' | sed '/<INFO>/d' | sed '/<USERS>/d' | sed -e 's/[0-9]\{4,\}\/[0-9]\{2,\}\/[0-9]\{2,\} [0-9]\{2,\}:[0-9]\{2,\}:[0-9]\{2,\}//g' | sed -e 's/\(.\{2\}\)//' > ryzomforge_archive.txt
#!/bin/bash
#Rewrite live chatlog and show in terminal (all channels)
tail -f ~/.local/share/Ryzom/0/save/log_heernis.txt | grep --line-buffered -v "(SYSTEM" | sed -u -e 's/\@{[A-Z0-9]\+}//g' | sed -u -e 's/ \* //g' | sed -u -e 's/(DYN[0-9])//g' | sed -u -e 's/\[[0-9] [A-Zaa-z]\+\] //g' | sed -u -e 's/\[[0-9] [A-Zaa-z]\+ [A-Zaa-z]\+\] //g' | sed -u -e 's/\/tellst//g'  | sed -u '/<INFO>/d' | sed -u '/<USERS>/d' | sed -u -e 's/([A-Z]\+)//g' | sed -u -e 's/[0-9]\{4,\}\/[0-9]\{2,\}\/[0-9]\{2,\} [0-9]\{2,\}:[0-9]\{2,\}:[0-9]\{2,\}//g' | sed -u -e 's/\(.\{1\}\)//'
Example:
2019/06/10 23:00:08 (DYN3) * @{EE3F}[3 ryzomforge] Nilstilar sagt: @{AFBF}Bonne nuit / Good night
Rewrites to
Nilstilar sagt: Bonne nuit / Good night
#!/bin/bash
#watch the log | filter only channel SAY/EMT | exchange charname with <Spieler> |exchange Aeps Zessen with <Ziel> | write it into  emotes.txt
tail -f /home/$USER/.local/share/Ryzom/0/save/log_heernis.txt | grep --line-buffered '(SAY/EMT)' | sed -u -e 's/\(.\{32\}\)//' | sed -u -e 's/\Heernis\b/<Spieler>/g' | sed -u -e 's/\Aeps Zessen\b/<Ziel>/g' >> emotes.txt
#!/bin/bash
# Skip System lines and cut out a part of the log based on time
grep -v "(SYSTEM" log_heernis.txt | sed -n "/2018\/06\/12 18:39/,/2018\/06\/12 18:40/p" log_heernis.txt > log_heernis_cutout.txt
#!/bin/bash
# Remove @{EE3F}
sed -e 's/\@{[A-Z0-9]\+}//g' log_heernis.txt > log_heernis
#Remove all System lines
grep -v '(SYSTEM' log_heernis.txt > log_heernis_edit.txt