Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: capture next block of text after finding error in file
Post: RE: capture next block of text after finding error...

(Nov-27-2019, 06:25 PM)buran Wrote: just to say that showing sample input text/file may help us enormously to help you. at the moment we just guess how your text looks like. Thanks Buran. Here is a ...
kdefilip2 General Coding Help 6 3,441 Nov-27-2019, 06:33 PM
    Thread: capture next block of text after finding error in file
Post: RE: Capture next word after search string

(Nov-27-2019, 05:21 PM)ThomasL Wrote: look at line 50, are you sure you want to slice something out of variable s ? When it comes to Python, I'm not sure of anything ;) The way I read that, s= "my ...
kdefilip2 General Coding Help 6 3,441 Nov-27-2019, 06:22 PM
    Thread: capture next block of text after finding error in file
Post: Capture next word after search string

Python 2.7 I am searching a file for an error string "reported errors in the". When this phrase is found, I need to capture the NEXT word immediately after the search string. Is there a way in Pyth...
kdefilip2 General Coding Help 6 3,441 Nov-27-2019, 04:38 PM
    Thread: capture next block of text after finding error in file
Post: capture next block of text after finding error in ...

I have some code to find an error message in an error log file. When the error is found, the very next block of text will be a path. I need to capture that path. In other words, I am searching a te...
kdefilip2 General Coding Help 6 3,441 Nov-26-2019, 07:07 PM
    Thread: Capture grep output to a variable which includes another variable
Post: RE: Capture grep output to a variable which includ...

Hi Scidam, Thanks for all your help. The only way I could get this working was with the following: p = Popen(["grep", "-wl", what, where], stdout=True, stderr=True) p.communicate()[0]It now returns ...
kdefilip2 General Coding Help 4 8,246 Nov-24-2019, 12:30 PM
    Thread: Capture grep output to a variable which includes another variable
Post: RE: Capture grep output to a variable which includ...

Scidam, that looked promising, but getting error. Also, had to change subprocess.run to subprocess.call due to being on Python 2.7. Here's my code: #!/usr/bin/env python # -*- coding: utf-8 -*- str...
kdefilip2 General Coding Help 4 8,246 Nov-22-2019, 02:22 PM
    Thread: Capture grep output to a variable which includes another variable
Post: Capture grep output to a variable which includes a...

I have set a variable strFileExt to a file path/name: /var/log/error.log.112119 I would now like to grep that file, capturing output to a second variable. If there is no output (text does not exist)...
kdefilip2 General Coding Help 4 8,246 Nov-21-2019, 06:51 PM

User Panel Messages

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