#!/bin/bash version=$1 read -r while [ -z "`echo $REPLY | grep -e "^#\+ $version"`" ] do read -r done read -r while [ -z "`echo $REPLY | grep -e "^#\+"`" ] do echo "$REPLY" read -r done