How to grab all lines after a match in Python
<p>I am very new to Python and I saw a post here: 
<a href="http://stackoverflow.com/questions/4595197/how-to-grab-the-lines-after-a-matched-line-in-python">How to grab the lines AFTER a matched line in python</a></p>

<p>I have a file that has data in the following format:
    DEFINE JOBPARM ID=(ns_ppprtg_notify,nj_pprtd028_notify,0028) </p>

<pre><code>SUBFILE='/sybods/prod/ca_scripts/ca_notify.ksh' SUBUSER=pbods SUBPASS=*PASSWORD*
</code></pre>

<p>I am attempting to extract each parameter so that I can construct the full command line.</p>

<p>Here is what I have so far:</p>

<pre><code>with open(myExtract) as Extract:
    for line in Extract:

        currentLine = line.strip("\n").strip()

        if currentLine.startswith("DEFINE JOBPARM ID=") or \
                currentLine.contains("PARM")):

            logger.info("Job Parameter line found")

            if "DEFINE JOBPARM ID=" in currentLine:
                tJobParmString = currentLine.partition("DEFINE JOBPARM ID=")[2].parition("SUBFILE")[0].strip()
                tSubFileString = currentLine.partition("SUBFILE")[2].partition("SUBUSER")[0].strip()
                tSubUserString = currentLine.partition("SUBUSER")[2].partition("SUBPASS")[0].strip()

                if re.match(" PARM", currentLine, flags=0):
                    logger.info("PARM line found")
</code></pre>

<p>This is where I am stuck...
I don't know for sure that there will be 2 PARM lines or 10. They all start with " PARM" and have numbers. How do I extract the values for PARM1, PARM2, PARM3 etc? 
Each of the PARM lines (PARM1, PARM2) always starts on a new line.</p>

<p>Any pointers would be appreciated.</p>

<pre><code>if("DEFINE JOBPARM ID=" in currentLine):
                tJobParmString=currentLine.partition("DEFINE JOBPARM ID=")[2].partition("SUBFILE")[0].strip()
                tSubFileString=currentLine.partition("SUBFILE")[2].partition("SUBUSER")[0].strip()
                tSubUserString=currentLine.partition("SUBUSER")[2].partition("SUBPASS")[0].strip()
            if(re.match("PARM",currentLine,flags=0)):
                logger.info("PARM line found")
                tParmString=currentLine.partition("=")[2].strip()
                logger.info(tParmString)
                if(not "PARM" in currentLine):
                    continue
</code></pre>

python