How can I redirect outputs of screen into a txt file?

Forum for OpenSees users to post questions, comments, etc. on the use of the OpenSees interpreter, OpenSees.exe

Moderators: silvia, selimgunay, Moderators

Post Reply
mannyh
Posts: 3
Joined: Sun Sep 21, 2008 7:46 pm
Location: Davis

How can I redirect outputs of screen into a txt file?

Post by mannyh »

Hello,

Is there anyway in Opensees (tcl) to create a txt file of the outputs of the opensees screen which includes all the "puts"outcomes?

Thank you,
Manny Hakhamaneshi
Graduate Student
University of California, Davis
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Post by fmk »

all opensees messages are directed to stderr .. you can use logFile to get them

puts outputs to stdout .. you can direct the puts output to a file usingputs $fileID output, where fileID is a variable set using the open command.

they will not be combined. however if you are on unix you can have both stdout and stderr directed to same file .. google it.
mannyh
Posts: 3
Joined: Sun Sep 21, 2008 7:46 pm
Location: Davis

logFile & stderr question

Post by mannyh »

Hello Frank and thank you for your previouse responses,

I was able to use outFileID and record the "puts" outputs into a text file however I am still having problem recording the messages that opensees gives and saving the screen outputs using logFile.
I would really appreciate it if you could guide me to use this command or maybe provide me with an example.

Sincerely,
Manny Hakhamaneshi
Graduate Student
University of California, Davis
r0d4n
Posts: 6
Joined: Thu Jun 07, 2007 9:39 am
Location: Univesità di Chieti

Post by r0d4n »

Hi mannyh,

You can try something like this:

set out [open textOut.txt a]
puts $out "Hello OpenSees!"
...
set a 1
puts $out "the number is $a"
...
close $out


the 'a' stands for 'append'

you can use 'w' to clean up your file
(the 'w' stands for 'write')

example:

set out [open textOut.txt w]
puts $out ""
close $out

______________________

RODAN
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Post by fmk »

if you put the command

logFile $fileName

at the start of your script. all output other than puts that appears on your screen as yu run OpenSees will be in the file $fileName when you are done.
Post Reply