I'm console application and want to save the output to a text file. So I do this:

Pi.exe > Pi.txt

Then open the text file and see this:

Calculating Pi to 10,000 decimal places...

Then I se Pi (3.14...)

How can I have the command prompt remove the Calculating Pi to 10,000 decimal places...?

link|improve this question

feedback

1 Answer

up vote 2 down vote accepted

If you wrote Pi.exe or can change it, the best two options are

  • Change Pi.exe to take a -q option to run 'quietly'
  • Have Pi.exe output 'Calculating Pi' etc to stderr, instead of stdout

Otherwise:

  • Pipe through find /v first:

    Pi.exe | find /v "Calculating Pi" > pi.txt
    

It will capture only lines that don't contain "Calculating Pi".

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.