5
sed -n '/foo/,/goo/p;/goo/q' <bigfile That would print only those lines. If you wanted the line numbers you'd add an =. sed -n '/foo/=;/goo/=;//q' <bigfile The q is important because it quits the input when it is called - else sed will continue to read the infile through to the end. If you ...