#!/bin/bash exec input_cross_guesses_x11.txt SPACES=" " function fmt_echo { local STRING="$1" STRING="${STRING//\\n/ }" STRING="${STRING// / }" echo -n "$STRING " if test ${#STRING} -lt $2 ; then echo -n "${SPACES:0:$2-${#STRING}}" fi } fmt_key_w=22 fmt_knm_w=14 #fmt_xfc_w=6 fmt_edc_w=14 #fmt_xfn_w=32 fmt_edn_w=40 # Do not kenerate guesses for low keys while read KEY DUMMY ; do if test "$KEY" = "\"KEY_KATAKANA\"" ; then break fi done while read LINUX_KEY LINUX_NUM X_4 X_NAME ; do if test "${LINUX_KEY:0:1}" != "\"" ; then continue fi KEY=${LINUX_KEY//\"} KEY=${KEY//KEY_} KEYF=$KEY KEY=${KEY//BTN_} echo -n "# Search for $KEY: " grep -i -r $KEY ~/PACKAGES/xkeyboard-config-stable-noarch/BUILD/xkeyboard-config-0.9 | grep -v COPYING | grep -v /README | grep -v /po/ | grep -v config | grep -v intltool | fgrep -v .xml | fgrep -v .m4 | grep -v ': /*' | grep -v "Makefil" | sed "s@.*/xkeyboard-config-0.9/@@" | tr '\n' ' ' grep -i -r $KEY /usr/include/X11/*key*.h | sed "s@.*/X11/@@" | tr '\n' ' ' echo '' fmt_echo "$LINUX_KEY" $fmt_key_w fmt_echo "$LINUX_NUM" $fmt_knm_w if test "$X_4" = "\"\"" ; then fmt_echo "\"${KEY:0:4}\"" $fmt_edc_w else fmt_echo "$X_4" $fmt_edc_w fi if test "$X_NAME" = "\"\"" ; then if test "${KEYF:0:4}" = BTN_ ; then NKEY="Button${KEYF:4:1}$(echo ${KEYF:5} | tr A-Z a-z )" else NKEY="${KEYF:0:1}$(echo ${KEYF:1} | tr A-Z a-z )" fi fmt_echo "\"NEW$NKEY\"" $fmt_edn_w else fmt_echo "$X_NAME" $fmt_edn_w fi echo done grep -v '^#' input_cross_guesses_x11x.txt