Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8123201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:06:02+00:00 2026-06-06T06:06:02+00:00

I have a long command saved in a file. I also have a list

  • 0

I have a long command saved in a file.
I also have a list of input files, which I want to pass to this same command,
so I have a %s specifier at two places.

$ 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;

Next I try it on the python REPL.

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

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

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

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T06:06:04+00:00Added an answer on June 6, 2026 at 6:06 am

    As you may have suspected, it seems you are only running time on the first command in your https-tcp-session.txt file. Your code in the Python REPL is sending something like the following to bash (or whichever shell you’re using):

    /usr/bin/time -f "%e" rm -f /tmp/A.raw /tmp/B.raw /tmp/result.raw; \
    rwfilter --sport=443 --proto=6 --pass=stdout %s | \
    rwsort --fields=sIP,dIP | \
    # rest omitted
    

    The semicolon at the end of the first line ends a command, so the shell runs time on rm only.

    One possible fix would be to wrap your block of commands in a group. That way, time runs on the group as a whole.

    Alternatively, you could use positional parameters. You could replace the %s symbols in your https-tcp-session.txt commands with $1, which bash interprets as the first command-line argument. You can then run https-tcp-session.txt as a shell script, passing the value to use in $1 as the command line argument, for example:

    $ bash https-tcp-session.txt trace.rwf.gz
    

    (Please note that I haven’t tested either approach.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a long shell command, something like this: cat file \ | perl
I have a very long command in bash, which I do not want to
I have long file with the following list: /drivers/isdn/hardware/eicon/message.c//add_b1() /drivers/media/video/saa7134/saa7134-dvb.c//dvb_init() /sound/pci/ac97/ac97_codec.c//snd_ac97_mixer_build() /drivers/s390/char/tape_34xx.c//tape_34xx_unit_check() (PROBLEM)/drivers/video/sis/init301.c//SiS_GetCRT2Data301() /drivers/scsi/sg.c//sg_ioctl()
Will using yes command waste lot of cpu cycles ? I have a long
I have long HTTP request ( generating large Excel file - about 60K records
One thing with which I have long had problems, within the CakePHP framework, is
Lets assume I have this long insert statement insert into table1 (id, name, phone,
I have a bunch of files (with same name, say abc.txt) strewn all over
Okay, this is more for my own learning than actual need. I have files
I'd like to be able to pass in a long command to expect. It's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.