On Mon, 6 Feb 2012 10:29:07 -0600, McKown, John <[email protected]> 
wrote:

>> -----Original Message-----
>> From: IBM Mainframe Discussion List
>> [mailto:[email protected]] On Behalf Of Bill Godfrey
>> Sent: Monday, February 06, 2012 10:19 AM
>> To: [email protected]
>> Subject: Re: Regular Expressions (OMVS)
>>
><snip>
>>
>> try this:
>>
>> awk 'sub(/CD[^Q]*QR/,"junkt")'
>>
>> or this:
>>
>> sed -e 's/CD[^Q]*QR/junkt/'
>>
>> Bill
>
>Will work on that specific example. But won't if a Q appears with some other 
>character after it, before the first QR.
>

Did you try it?

Where a Q appears with some other character after it, before the first QR? I 
did. It skips to the one that has the first QR, as it should.

echo "QQQQABCDEFGNOPQSXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ" | awk 
'sub(/CD[^Q]*QR/,"junkt")'

QQQQABCDEFGNOPQSXXXPPPPABjunktYYYOOOOABCDEFGNOPQRZZZ

I see that Ken has added to the problem description since my earlier reply. 

Bill

Bill

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to