From TRS-80, 1 Week ago, written in Bash.
  1. #!/bin/bash
  2.  
  3. gawk -v var="$descrip_match" -v ORS='\0' '$0 ~ var' RS= "$beanfile" | while read -rd '' i;
  4. do
  5.     # do a whole bunch of things to each transaction, and then...
  6.  
  7.     # for each transaction that has been printed, ask what you would like to do
  8.     # Export, Skip, Quit program or ???
  9.     printf 'What would you like to do with this transaction?\n
  10.    Add it to tmp.beancount, Skip it for now, or Quit processing transactions?\n'
  11.     read -n 1 -p "Input selection:" keypress
  12.     while true
  13.     do
  14.         case $keypress in
  15.             [Aa]* ) echo "You entered A."
  16.                 ;;
  17.             [Ss]* ) echo "You entered S."
  18.                 ;;
  19.             [Qq]* ) echo "You entered Q."
  20.                 ;;
  21.             * ) echo "You did not enter a valid choice."
  22.                 ;;
  23.         esac
  24.     done
  25.    
  26.     # put some newlines before next transaction
  27.     printf "\n\n\n"
  28.        
  29. done
  30.  
captcha