Added support for printing to file with the -o option.