Skip to content

Instantly share code, notes, and snippets.

@jigpu
Last active February 13, 2018 17:32
Show Gist options
  • Save jigpu/f6e5600496e0edd5ec26076577d39d23 to your computer and use it in GitHub Desktop.
Save jigpu/f6e5600496e0edd5ec26076577d39d23 to your computer and use it in GitHub Desktop.
Transform `xinput test-xi2` multitouch output into a (potentially very wide) table of touch sequences
# Run me with `awk -f <progfile>`
/^$/ {
if (E=="") {
next;
}
for (i = 0; i < N-NN; i++) {
printf("%*s; %*s; %*s; %*s", 10, "", 10, "", 10, "", 10, "")
}
printf("%10.10s; %10.10s; %10.10s; %10.10s\n", N, E, A[0], A[1]);
}
/EVENT/ {
gsub(/[()]/,"",$4);
E=$4;
}
/detail:/ {
if (N==0) {
NN=$2;
}
N=$2;
}
/^ *[0-9]:/ {
gsub(/[ :]/,"",$1);
A[$1]=$2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment