Python Forum
Python equivalent to sed [solved]
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python equivalent to sed [solved]
#3
Thanks for your reply Nilamo, I see my mistake now.

content = os.popen("sed -n '/time/, +3p' mon").read()

The solution I used was string concatenation:

str1 = "sed -n '/" + str(time)+ "/, +3p' mon"

content = os.popen(str1).read()
It may not be the best or indeed the only solution but it
works for my purpose.
Reply


Messages In This Thread
Python equivalent to sed [solved] - by cygnus_X1 - Sep-24-2018, 02:32 PM
RE: Python equivalent to sed - by nilamo - Sep-24-2018, 03:08 PM
RE: Python equivalent to sed [solved] - by cygnus_X1 - Sep-24-2018, 10:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Equivalent Python code from VBA Mishal0488 2 797 Apr-19-2024, 10:32 AM
Last Post: masonsbore
  Python C++ Template Equivalent deanhystad 7 3,415 May-04-2021, 07:45 PM
Last Post: deanhystad
  Hi Guys, please help me to write SAS macro parameter equivalent code in Python Manohar9589 2 2,612 Jun-14-2020, 05:07 PM
Last Post: Larz60+
  python equivalent to MATLAB xcov chai0404 2 3,890 Apr-02-2020, 10:29 PM
Last Post: chai0404
  Python equivalent of Matlab code kwokmaster 1 3,464 Mar-25-2020, 10:14 PM
Last Post: j.crater
  Equivalent of 'bwareafilt' for Python Mighty 1 3,617 Feb-05-2020, 10:32 PM
Last Post: Marbelous
  Convert a mongo db scrip to python equivalent Herath 1 2,198 Aug-20-2019, 02:28 PM
Last Post: fishhook
  SAS Equivalent of Macro variable in Python AI_ML_Neophyte 4 11,688 Mar-29-2019, 08:14 AM
Last Post: FelixS
  equivalent commands saeed_balk 2 2,701 Sep-23-2018, 05:44 AM
Last Post: saeed_balk
  Python "read -n" equivalent? rhubarbpieguy 8 6,780 Jan-24-2017, 12:51 PM
Last Post: rhubarbpieguy

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020