How to output values of the variable in tree into txt file?

Hi, all:

I would like to know how to output the values of one variable in the tree into ascii txt file?
Using tree.Scan(“XXX”); only can print out the values in the screen. I am a newer. If you know, could you tell me how to do in details? Thanks in advance!


do at the command line
tree.Scan(“xxx”); >file.txt


It works. Thanks.