Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: CAD Program Post Processing

24 views
Skip to first unread message
Message has been deleted

frank.w...@gmail.com

unread,
Apr 30, 2013, 11:01:05 AM4/30/13
to
From me at :
>Hi,

>Trying to get stderr and stdout written to a file, but
>still have
>output sent to the screen.

>The bat files are Win7 cmdprompt 12 dos shell.

What does that mean?

>This one works for the redirect. How to make this also
>write to the screen?

>in bat file ------------------
> dbdoctor -drc -shapes -no_backup %1 2> check_wn_stderr
>1> check_wn_stdout
>output file contains ---------
> outputs files correctly with normal screen contents.
>------------------------------

Do the same as you did with Linux: 1>file 2>&1

Then 'cat' the file: TYPE file

If you really need 1 and 2 in separate files but
synchronized on the screen then you will need more work.

Frank
Message has been deleted

Todd Vargo

unread,
Apr 30, 2013, 3:20:48 PM4/30/13
to
On 4/30/2013 9:42 AM, me at wrote:
> Hi,
>
> Trying to get stderr and stdout written to a file, but still have
> output sent to the screen.
>
> Entered the same in both linux and dos as "check some.brd"
> The first is #!/bin/sh in linux.
> The bat files are Win7 cmdprompt 12 dos shell.
>
>
> works in linux ---------------
> Writes to screen and also stderr stdout to the file check_ix_screen
> dbdoctor -drc -shapes -no_backup $1 2>&1 | tee -a check_ix_screen
> ------------------------------
>
>
> This one works for the redirect. How to make this also write to the screen?
>
> in bat file ------------------
> dbdoctor -drc -shapes -no_backup %1 2> check_wn_stderr 1> check_wn_stdout
> output file contains ---------
> outputs files correctly with normal screen contents.
> ------------------------------

This is a FAQ. You need to download a TEE utility for Windows.

Timo posts a FAQ on a weekly basis (yesterday in fact) which includes a
TEE.VBS which can be used similar to a TEE.EXE utility.

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

frank.w...@gmail.com

unread,
Apr 30, 2013, 3:09:58 PM4/30/13
to
From me at :
> | Do the same as you did with Linux: 1>file 2>&1
> |
> | Then 'cat' the file: TYPE file

>Yes, but then I cannot monitor it while it is running,
>which sometimes is a long time.

Windows doesn't have a TEE program so here are your
options:

- Use a third-party TEE, there are probably several. Since you are experienced with Linux you would probably be happy with the set of Linux tools which have been ported to Windows (I've forgotten the name).

- See if PowerShell, Visual Basic Script, or JScript
will do the job.

Frank

Auric__

unread,
Apr 30, 2013, 10:57:59 PM4/30/13
to
frank.westlake wrote:

> From me at :
> > | Do the same as you did with Linux: 1>file 2>&1
> > |
> > | Then 'cat' the file: TYPE file
>
> >Yes, but then I cannot monitor it while it is running,
> >which sometimes is a long time.
>
> Windows doesn't have a TEE program so here are your
> options:
>
> - Use a third-party TEE, there are probably several. Since you are
> experienced with Linux you would probably be happy with the set of
> Linux tools which have been ported to Windows (I've forgotten the
> name).

There are a few. I believe MinGW is kept pretty current. I use the version of
GnuWin that's included with Ch. ( http://www.softintegration.com/ if you're
interested.)

> - See if PowerShell, Visual Basic Script, or JScript
> will do the job.

--
- So what are you having?
- Gin. Make it a double.
- Me too.
- So that's double, double and... you've got toilet trouble?
Message has been deleted

Frank Westlake

unread,
May 1, 2013, 11:20:55 AM5/1/13
to
2013-05-01 08:03, me at:
> What I tried in my script, 3 different tries,
> dbdoctor -drc -shapes -no_backup vic.brd | cscript /nologo c:\bin\TEE.VBS 2> check_wn_stderr 1> check_wn_stdout
> dbdoctor -drc -shapes -no_backup vic.brd | c:\bin\TEE.VBS 2> check_wn_stderr 1> check_wn_stdout
> dbdoctor -drc -shapes -no_backup vic.brd | c:\bin\TEE.VBS > check_wn_screen

The pipe only connects STDOUT to STDIN, it does not even think about
other streams. If you want STDERR to go to the pipe redirect it to
STDOUT (2>&1):

dbdoctor -drc -shapes -no_backup vic.brd 2>&1 | [your TEE program here]


Frank

Todd Vargo

unread,
May 1, 2013, 4:58:17 PM5/1/13
to
On 5/1/2013 11:03 AM, me at wrote:
> Thank you for the replies.
>
> I found the vbs script at
> http://www.netikka.net/tsneti/info/tscmd094.htm It only will give
> me stdout.
>
> The tee.exe from softintegration gives it all, so I am using it.
> Although, it gives the stderr and stdout in opposite order from
> the linux one.
>
> Thanks,
>
> Vic
>
>
>
> - tee.vbs 8< ----------------------------------------------------
> Dim str
> Do While Not WScript.StdIn.AtEndOfStream
> str = WScript.StdIn.ReadLine
> WScript.StdOut.WriteLine str
> WScript.StdErr.WriteLine str
> Loop
> - >8 tee.vbs ----------------------------------------------------
>
> -----------------------------------------------------------------
> What I tried in my script, 3 different tries,
> dbdoctor -drc -shapes -no_backup vic.brd | cscript /nologo c:\bin\TEE.VBS 2> check_wn_stderr 1> check_wn_stdout
> dbdoctor -drc -shapes -no_backup vic.brd | c:\bin\TEE.VBS 2> check_wn_stderr 1> check_wn_stdout
> dbdoctor -drc -shapes -no_backup vic.brd | c:\bin\TEE.VBS > check_wn_screen
>
>
> I copied pasted the tee.vbs and inserted it into my bat file.
> Works good except I only get stdout in the file. Same behaviour
> with all three of the above lines. I also tried swapping, in the
> tee.vbs lines 4 and 5.
>
> -----------------------------------------------------------------
> What I get with the tee.vbs, only stdout, no stderr,
>
> 0 warnings, 0 errors detected, 0 errors fixed.
> Writing database to disk.
>
>
> -----------------------------------------------------------------
> This is my goal, it is what I get in the log file when I run it
> the old way, when I run it without any screen output, without
> tee.vbs. Like this
> dbdoctor -drc -shapes -no_backup vic.brd 2> check_wn_stderr 1> check_wn_stdout

Try this (tested using a DIR command with file not found output)...

dbdoctor args 2>&1 | cscript /nologo c:\bin\TEE.VBS > all_output

VBScript's .stderr will be sent to screen while .stdout will be
redirected to file named all_output.

In otherwords, do not misuse 2>file because all output from dbdoctor
will be included in both the file as well as on screen.
0 new messages