Skip to content

Instantly share code, notes, and snippets.

Created August 22, 2012 17:53
Show Gist options
  • Save anonymous/3427922 to your computer and use it in GitHub Desktop.
Save anonymous/3427922 to your computer and use it in GitHub Desktop.
stdin
#!/bin/bash
print=0
while read line; do
echo "CERR: $line" 1>&2
if [[ "$(echo $line | cut -d':' -f3)" == "opencyc_jac" ]]; then
echo "CERR: to cyc: $(echo "$line" | cut -d':' -f4-)" 1>&2
echo "$line" | cut -d':' -f4-
fi
done | ./run-cyc.sh | while read oline; do
echo "CERR: $oline" 1>&2
if [[ -n "$(echo $oline | grep "^CYC")" ]]; then
print=1
fi
if [[ $print == 1 ]] && [[ -z $(echo $oline | grep '^at') ]]; then
echo "CERR: from cyc: $oline" 1>&2
echo "PRIVMSG #uakroncs :$oline"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment