如何将程序的输出存储到文件中?
How to store my program's output into a file?
spykoni@spykoni-H81M-S2PV:~/Desktop/C_plus_plus/MIXMAX/mixmax_release_100_beta$
spykoni@spykoni-H81M-S2PV:~/Desktop/C_plus_plus/MIXMAX/mixmax_release_100_beta$
spykoni@spykoni-H81M-S2PV:~/Desktop/C_plus_plus/MIXMAX/mixmax_release_100_beta$
spykoni@spykoni-H81M-S2PV:~/Desktop/C_plus_plus/MIXMAX/mixmax_release_100_beta$ cat screen.log
Script started on Δευ 06 Απρ 2015 05:13:12 μμ EEST
spykoni@spykoni-H81M-S2PV:~/Desktop/C_plus_plus/MIXMAX/mixmax_release_100_beta$ ./testU01
Welcome to the MIXMAX random number generator!
The curent matrix size is 256, with arithmetic mod 2^61-1
special entry in the matrix is -1
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Starting SmallCrush
Version: TestU01 1.2.3
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
***********************************************************
HOST = spykoni-H81M-S2PV, Linux
float
smarsa_BirthdaySpacings test:
-----------------------------------------------
N = 1, n = 5000000, r = 0, d = 1073741824, t = 2, p = 1
Number of cells = d^t = 1152921504606846976
Lambda = Poisson mean = 27.1051
----------------------------------------------------
Total expected number = N*Lambda : 27.11
Total observed number : 23
p-value of test : 0.75
-----------------------------------------------
CPU time used : 00:00:00.97
Generator state:
我有一个 C++ 程序,我在 Linux 中 运行,在 运行ning 程序之后它给了我很多信息作为输出,我想保存文件中的此信息以便以后查看所有信息,因为它很大。我可以保存或者说是记录 Linux 中屏幕上的所有信息。正如我所看到的,有多种方法可以做到这一点,但我只想保存程序输出的信息。在此示例中,我只想保存自 Starting SmallCrush 以来的信息,因为我的程序从那里开始打印信息。我不想要 """ /mixmax_release_100_beta$ cat screen.log
脚本开始于 Δευ 06 Απρ 2015 05:13:12 μμ EEST """ 这样的额外行。
运行 你的程序像:
$ ./testU01 | tee testU01.out
将在 stdout
上显示程序的输出,但也会将其存储到文件 testU01.out
。
查看 man 1 tee
了解更多信息。
spykoni@spykoni-H81M-S2PV:~/Desktop/C_plus_plus/MIXMAX/mixmax_release_100_beta$
spykoni@spykoni-H81M-S2PV:~/Desktop/C_plus_plus/MIXMAX/mixmax_release_100_beta$
spykoni@spykoni-H81M-S2PV:~/Desktop/C_plus_plus/MIXMAX/mixmax_release_100_beta$
spykoni@spykoni-H81M-S2PV:~/Desktop/C_plus_plus/MIXMAX/mixmax_release_100_beta$ cat screen.log
Script started on Δευ 06 Απρ 2015 05:13:12 μμ EEST
spykoni@spykoni-H81M-S2PV:~/Desktop/C_plus_plus/MIXMAX/mixmax_release_100_beta$ ./testU01
Welcome to the MIXMAX random number generator!
The curent matrix size is 256, with arithmetic mod 2^61-1
special entry in the matrix is -1
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Starting SmallCrush
Version: TestU01 1.2.3
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
***********************************************************
HOST = spykoni-H81M-S2PV, Linux
float
smarsa_BirthdaySpacings test:
-----------------------------------------------
N = 1, n = 5000000, r = 0, d = 1073741824, t = 2, p = 1
Number of cells = d^t = 1152921504606846976
Lambda = Poisson mean = 27.1051
----------------------------------------------------
Total expected number = N*Lambda : 27.11
Total observed number : 23
p-value of test : 0.75
-----------------------------------------------
CPU time used : 00:00:00.97
Generator state:
我有一个 C++ 程序,我在 Linux 中 运行,在 运行ning 程序之后它给了我很多信息作为输出,我想保存文件中的此信息以便以后查看所有信息,因为它很大。我可以保存或者说是记录 Linux 中屏幕上的所有信息。正如我所看到的,有多种方法可以做到这一点,但我只想保存程序输出的信息。在此示例中,我只想保存自 Starting SmallCrush 以来的信息,因为我的程序从那里开始打印信息。我不想要 """ /mixmax_release_100_beta$ cat screen.log 脚本开始于 Δευ 06 Απρ 2015 05:13:12 μμ EEST """ 这样的额外行。
运行 你的程序像:
$ ./testU01 | tee testU01.out
将在 stdout
上显示程序的输出,但也会将其存储到文件 testU01.out
。
查看 man 1 tee
了解更多信息。