Steve As on Windows, so on Unix: if you get your stdin and stdout redirects in a twist (I always do) just bracket the lot Try: ( lsnrctl <<EOF set password $LSNR_PASS show log_directory exit EOF ) | awk -f ... >myoutfile.log Regards Nigel