Skip to content

Instantly share code, notes, and snippets.

@zhum
Created July 31, 2022 09:20
Show Gist options
  • Save zhum/8def41e2dcd4aaa067099e352061e5a8 to your computer and use it in GitHub Desktop.
Save zhum/8def41e2dcd4aaa067099e352061e5a8 to your computer and use it in GitHub Desktop.
awk replacement sample
#!/bin/sh
# replace "Nodename=abc Uptime=1 CPUs=128 State=Drain Reason=no cpu detected [12:00]" -> "abc: no cpu detected"
gawk '{print gensub(/NodeName=([[:alnum:]]+).*Reason=([^[]+)\[.*/, "\\1: \\2", "g") }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment