I know that if file is
now
is
the
time
for
all
good
men
house
boat
car
for
sed -n -e '/is/,/for/p' file
will print
is
the
time
for
But how do I get, for instance ONLY
the line "is"
and the next occurrence of "for"
Search for "is", if I find "is", search for and print "is" and the first occurrence of "for"