Skip to content

Instantly share code, notes, and snippets.

@nathanfranke
Created May 5, 2021 05:57
Show Gist options
  • Save nathanfranke/cbd4d6442249058f502592845f20064b to your computer and use it in GitHub Desktop.
Save nathanfranke/cbd4d6442249058f502592845f20064b to your computer and use it in GitHub Desktop.
Minecraft: Filter Matrix AC trial message with grep
java -Dterminal.jline=false -Dterminal.ansi=true -jar Paper-*.jar nogui | grep --color=never --invert --extended-regexp '^.{0,3}\[[[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2} INFO\]: '"$(printf \\e)"'\[[0-9;]*m\[Matrix\] '"$(printf \\e)"'\[[0-9;]*m\(!\) You are currently using free\(trial\) version of Matrix!'"$(printf \\e)"'\[[0-9;]*m$'
@nathanfranke
Copy link
Author

-Dterminal.jline=false -Dterminal.ansi=true - Force colored output even though we are piping to grep.
.{0,3} - Output can start with 0-3 garbage characters (usually ansi escape codes). This check can be improved.
\[[[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2} INFO\]: - Message timestamp and type.
'"$(printf \\e)"'\[[0-9;]*m\[Matrix\] '"$(printf \\e)"'\[[0-9;]*m\(!\) You are currently using free\(trial\) version of Matrix!'"$(printf \\e)"'\[[0-9;]*m$' - Actual message. Each printf instance converts \ESC[123m codes.

@KingNick1
Copy link

Hello, when the console starts, it turns off immediately

@nathanfranke
Copy link
Author

nathanfranke commented Sep 6, 2021

Hello, when the console starts, it turns off immediately

  • Are you on the latest version of Paper spigot?
  • Is your paper jar named Paper-*.jar where * is anything?
  • Are you using Linux? You need Linux for this (or a bash shell with gnu corelibs installed). If you don't know what Linux is, you probably aren't using it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment