Hi all,

I am running the following command:

time wc filename >wc.out 2>time.out

in order to place the wc output into wc.out and the output from time into time.out. wc.out is fine but time.out is empty. I can't see where I am going wrong.

Thanks for any help offered.

5 Years
Discussion Span
Last Post by Tinnin

The reason you aren't getting what you want out of the command is because you are redirecting the error output from the wc command into time.out. NOT the error output from the time command.
What you need to do is this:

time (wc filename >wc.out) 2> time.out

That will redirect the output from the wc command into a file called wc.out and will redirect the standard error output of the time command to a file called time.out

Edited by JasonHippy


Thanks guys.
JasonHippy: It makes sense looking at it like that.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.