in reply to Searching a pattern's first and last occurrence in a file.
Tip Use a regex!
Cheers Rolf
( addicted to the Perl Programming Language)