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 8303725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:36:40+00:00 2026-06-08T17:36:40+00:00

I want to run a command like this grep -w 1 pattern <(tail -f

  • 0

I want to run a command like this

grep -w 1 pattern <(tail -f mylogfile.log)

basically from a python script i want to monitor a log file for a specific string and continue with the python script as soon as i found that.
I am using os.system(), but that is hanging. The same command in bash works good.

I have a very old version of python (v2.3) and so don’t have sub-process module.

do we have a way to acheive this

  • 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-08T17:36:41+00:00Added an answer on June 8, 2026 at 5:36 pm

    In Python 2.3, you need to use subprocess from SVN

    import subprocess
    import shlex
    subprocess.call(shlex.split("/bin/bash -c 'grep -w 1 pattern <(tail -f mylogfile.log)'"))
    

    To be explicit, you need to install it from the SVN link above.

    You need to call this with /bin/bash -c due to the shell redirection you’re using


    EDIT

    If you want to solve this with os.system(), just wrap the command in /bin/bash -c since you’re using shell redirection…

    os.system("/bin/bash -c 'grep -w 1 pattern <(tail -f mylogfile.log)'")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program that is run from the command line like this python
I want to run command like this: vim -c %g/blablabla/norm /str<ESC>cwSTR file How I
Hey i want to run from an vbs script a powershell commando. Something like
tmp-file contains: database_1 database_2 database_3 I want to run a command like mysqldump DATABASE
I want to run the following command from a C program to read the
here i want to run this program and take one character pointer like char
I need to run a command in PHP like this: exec('dosomething > saveit.txt'); Except
I want to run some command from a remote server in my php using
This is my situation: I want to run Python scripts sequentially in sequence, starting
I want create a ruby script that I can run on the command line

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.