From 0ab091a8cdcbd34b82e8de1afc113544b2fad6e7 Mon Sep 17 00:00:00 2001 From: terminalforlife Date: Wed, 27 Nov 2019 00:06:45 +0000 Subject: [PATCH] Add alternative approach to parsing `xev` --- sheets/xev | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sheets/xev b/sheets/xev index 36690ac..ad7fcdb 100644 --- a/sheets/xev +++ b/sheets/xev @@ -1,3 +1,15 @@ # Show keycodes used by Xorg # start xev and show only the relevant parts: xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }' + +# Alternative approach to show keycodes, with standard AWK formatting. +awk ' + /^KeyPress/ { + A[NR+2] + } + + NR in A { + B=substr($7, 0, length($7) - 2) + printf("%3d %s\n", $4, B) + } +' <(xev)