From f65469a59ab64b7e030f5e4b785450de7f4f1092 Mon Sep 17 00:00:00 2001 From: Stefan Tomanek Date: Tue, 26 Oct 2010 16:15:57 +0200 Subject: [PATCH] add basic awk scripts --- conf.awk | 18 ++++++++++++++++++ fp.awk | 15 +++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 conf.awk create mode 100644 fp.awk diff --git a/conf.awk b/conf.awk new file mode 100644 index 0000000..f7df401 --- /dev/null +++ b/conf.awk @@ -0,0 +1,18 @@ +#!/usr/bin/awk + +/^[^ ]+ disconnected / { + OUTPUT[$1] = "--off"; +} + +/^[^ ]+ connected / { + split($3, A, "+"); + OUTPUT[$1] = "--mode "A[1]" --pos "A[2]"x"A[3]; +} + +END { + printf "xrandr "; + for (O in OUTPUT) { + printf "--output " O " " OUTPUT[O] " "; + } + printf "\n"; +} diff --git a/fp.awk b/fp.awk new file mode 100644 index 0000000..5d0f497 --- /dev/null +++ b/fp.awk @@ -0,0 +1,15 @@ +#!/usr/bin/awk +/^[^ ]+ (dis)?connected / { + DEV=$1; + ID[DEV] = ""; +} + +$1 ~ /^[a-f0-9]+$/ { + ID[DEV] = ID[DEV] $1 +} + +END { + for (X in ID) { + print X " " ID[X]; + } +}