I'd like to check my minecraft server for online players using /list in server console. This gives me the following input. The goal is to compare if the player is in an specific list. If he isn't, we kick him. In output.log there are listed the allowed players (each one line).
mc()
{
screen -S mcserver -p 0 -X stuff "$1^M"
}
if ! grep -q $player output.log; then
echo "$player do not runs launcher."
mc "kick $player"
We'd like to filter the following input for players to get the online players and then can check if there are in the allowed list:
[18:43:08] [pool-2-thread-528/INFO]: There are 2/100 players online.
[18:43:08] [pool-2-thread-528/INFO]: Tester1212, Me99666
The idea behind is to filter the input using awk and find them by watching for , or something like.
The final output should be (each as one line):
Tester1212
Me99666
An problem could be to filter it if only 1 player is online and there is no , .