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.

Recommended Answers

All 3 Replies

try this (I don't know if it will work or not):

time > time.out | wc > wc.out

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.