I am using the following command line to analyse data:

unpackdcm -scr ${in} -targ ${out} 

This command is printing on the screen status and description about the progress in the job. In order to save the status I did the following:

unpackdcm -scr ${in} -targ ${out} >stat.txt

But it did not work.

  • 1
    Try unpackdcm -scr ${in} -targ ${out} | tee stat.txt. – Ramesh Oct 21 '14 at 20:48

The >-sign represents an I/O-Redirection. With >stat.txt you redirect the standard output (stdout) of the application to the file stat.txt. It is redirected, so you will not see any output in the shell.

If you want the output in the current shell AND the file pipe the output into tee:

your_command | tee stat.txt


your_command | tee -a stat.txt

..to append to the file.

Your application may also produce some errors. They mostly occure in the standard error (see standard streams). To redirect that stream use the folloing syntax:

your_command 2>error.log

It's possible that the output is being sent to stderr which is not captured by the > operator which only captures stdout.

Instead, if you are using the bash shell, try routing stderr to stdout and into a file using the &> operator. For example:

unpackdcm -scr ${in} -targ ${out} &>stat.txt

To redirect only stderr, use this:

unpackdcm -scr ${in} -targ ${out} 2>stat.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy