junk
junk
MARK
I want this line
junk
junk
junk
MARK
I want this line
junk
junk
MARK
I want this line
junk
junk
junk
junk
MARK
I want this line
MARK
I want this line
and so forth? No particular patterns/line counts to rely on - just the
presence of "MARK" lets me know that the next line is valuable. I spent some
time reading man pages, and managed to hit
MEGO. :-(
SCO OSE 505
Thanks!
--
_________________________________________
Nachman Yaakov Ziskind, EA, CNE aw...@egps.com
Attorney and Counselor-at-Law http://yankel.com
Economic Group Pension Services http://egps.com
Actuaries and Employee Benefit Consultants
Assuming your data is in a file called "data" try this:
$ awk '/^MARK/ { OK = 1; continue } OK == 1 { print $0; OK = 0 }' data
--
Darryl
Ideal Computer Group Inc.
here's a quick and dirty awk script that worked on your example text (and I even though in some comments to help you out).
#!/usr/bin/awk
begin {
#
# pnext is basicly a boolean that
# tells awk to print the next line if it's set
#
#
#set it to 0 (false) initially
#
pnext = 0;
}
#
# main procedure...
#
{
#
# if pnext is set print this line
# and reset pnext
#
if (pnext == 1) {
print $0;
pnext = 0;
}
}
#
# match /MARK/ and set pnext if it's found
# this has to be after the main proc to get it
# to pick up the next line in the stream.
#
/MARK/ {
pnext = 1;
}
dave