Skip to content

Instantly share code, notes, and snippets.

@JAChapmanII
Forked from anonymous/stdin.txt
Created August 22, 2012 17:53

Revisions

  1. JAChapmanII renamed this gist Aug 22, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @invalid-email-address Anonymous created this gist Aug 22, 2012.
    19 changes: 19 additions & 0 deletions stdin.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    #!/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