script

Often times your instructor will ask you to submit a copy of your program's output running specific input. You can capture the screen output of shell program using script (script takes an optional filename arg. Without it, script's output will go to a file named typescript) For example:
  $ script
  Script started, file is typescript
  % ./myprog
    all my programs output and any input the user enters....
  % exit
  exit
  Script done, file is typescript
Then, clean-up the typescript file by running dos2unix:
$ dos2unix -f typescript    # you may need to run dos2unix more than 
                            # one time to remove all carriage return chars

$ mv typescript outputfile   # put your cleaned-up file in a file named 
                             # output so that next run of script doesn't 
                             # overwrite it

# you can also just give a command line option to script that specifies
# the script file name:
$ script foo
 Script started, file is foo
 % 
Finally, edit the outputfile by inserting comments around the specific parts of your program's output that you want to highlight.