1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/bin/sh hxtoh() { flag=1 while read -r str; do case $str in HXCOMM*) ;; SRST*|ERST*) flag=$(($flag^1)) ;; *) test $flag -eq 1 && printf "%s\n" "$str" ;; esac done } case "$1" in "-h") hxtoh ;; *) exit 1 ;; esac exit 0