How to group a list of commands to time them as a unit?
<p>I have a long command saved in a file.<br>
I also have a list of input files, which I want to pass to this same command,<br>
so I have a <code>%s</code> specifier at two places.</p>

<pre><code>$ cat https-tcp-session.txt

rm -f /tmp/A.raw /tmp/B.raw /tmp/result.raw; \
rwfilter --sport=443 --proto=6 --pass=stdout %s | \
rwsort --fields=sIP,dIP | \
rwgroup --id-fields=sIP,dIP --summarize | \
rwfilter --input-pipe=stdin --pass=/tmp/A.raw --packets=200-; \
rwfilter --dport=443 --proto=6 --pass=stdout %s | \
rwsort --fields=sIP,dIP | \
rwgroup --id-fields=sIP,dIP --summarize | \
rwfilter --input-pipe=stdin --pass=/tmp/B.raw --packets=200-; \
rwmatch --relate=1,2 --relate=2,1 \
/tmp/A.raw /tmp/B.raw /tmp/result.raw;
</code></pre>

<p>Next I try it on the python REPL.</p>

<pre><code>&gt;&gt;&gt; cmd = open('https-tcp-session.txt').read()
&gt;&gt;&gt; cmd = cmd.replace('%s', 'trace.rwf.gz')
&gt;&gt;&gt; time = '/usr/bin/time -f "%e"'
&gt;&gt;&gt; stmt = '%s %s'%(time, cmd)
&gt;&gt;&gt; os.system(stmt)
0.01 
0
</code></pre>

<p>That does not seem right.
For curiosity I put in an input file, and try to run it from the shell</p>

<pre><code>$ /usr/bin/time -f "%e" bash https-tcp-session.txt
17.73
</code></pre>

<p>I have a feeling time is only timing the first command in the block (rm)</p>
