I am trying to search between patterns. I know sed will do it if it is a single occurrence.
Here is the file:
Iowa<br>
data1<br>
data2<br>
Montana<br>
junk1<br>
junk2<br>
junk3<br>
Iowa<br>
data3<br>
data4<br>
Arizona<br>
junk5<br>
junk6<br>
I am trying to get the content between Iowa and Montana.
So, I do sed -ne '/Iowa/,/Montana/p $file and see a result like this:
Iowa<br>
data1<br>
data2<br>
Montana<br>
Iowa<br>
data3<br>
data4<br>
Arizona<br>
junk5<br>
junk6<br>
Not sure why it prints Iowa - Arizona and beyond. Is there a way to print the content between Iowa and Montana only?
As a temporary workaround, I am printing all and taking the 1st occurrence.