Append an output from program to a file bash script -
I have to implement several types of programs in the shell shell like the following:
For $ I {1..10}; Do the time /aout;
Each recurrence generates the following output:
start the actual 0m1.112s user 0m1.112s sys 0m0.00s
I need to add a real part to this output (generated on each iteration), that is, 0m1.112s (extracted from the actual 0m1.112s) in some output files. The final output may look like this:
1.112s, 1.113s, 1.112s, 1.113s, 1.112s
I have created a program This and it works perfectly but the problem is that it creates some overhead and produces a little more variety in the time of execution.
will do the following: for
((i = 0; i < 10; i ++)) {time ./a.out> / Dev / null}} 2> And did it 1 Awk '{ORS = ","; Then outputs ($ 1 == "actual") print for $ 2} '
; & Amp; 1 will send stdout to stdr & gt; / Dev / null
will leave the actual output, if any, because you are only interested in the output of time
"real
with ,
to set the output separator from " ORS
so that all outputs are in a single row.
Comments
Post a Comment