× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



awk, sed and grep all work on one line at a time. In the version of grep that I have on my FreeBSD machine, I can specify -A 2 and it'll print two extra lines after the ones that match -- a second grep could then be used to find the ones that match the second line. However, the grep tool QShell appears to be a stripped down version that doesn't have this feature.

So I think your best bet is to write a program to do the search.


Adam Glauser wrote:
Do any of the text processing tools (ala FNDSTRPDM, awk, sed, grep, etc) available on a System i allow a multi-line search? My search is "find a line containing X which is not followed by a line containing Y or Z."

I suspect I'll have to do this in two parts, one which finds all of the members to process (those with a line containing X), and then calls a program for each which finds that line, reads the next line, and outputs the file name if the next line matches the Y or Z criterion.

I'm not too familiar with non-FNDSTRPDM options, so I thought I'd see which one to look at, if any.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.