add basic awk scripts

This commit is contained in:
Stefan Tomanek 2010-10-26 16:15:57 +02:00
commit f65469a59a
2 changed files with 33 additions and 0 deletions

18
conf.awk Normal file
View File

@ -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";
}

15
fp.awk Normal file
View File

@ -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];
}
}