$ perl -ne'/start/i .. /end/i and print' file $ perl -ne'/\b start \b/ix ... /\b end \b/ix and print' file