in reply to Search between pattern and append

What does your input look like? What are the values of $i and $j?

How does your program fail?

Replies are listed 'Best First'.
Re^2: Search between pattern and append
by Anonymous Monk on Jul 13, 2018 at 16:39 UTC
    START $i MAY JUNE JULY END $j
    here $i and $j are variables which change. I am trying to search (with a one liner) between the pattern1 and pattern2 and prefix a variable.
    perl -ne ' print if /START $i/ .. /END $j/' file.txt
    EXPECTED RESULT:
    START $i $i $j MAY $i $j JUNE $i $j JULY END $j
    The $i and $j values change with variable