Issue
How can I get text using grep command txt that seats between two strings?
for example:
<--string 1-->
the text i need
<--string 2-->
the "the text i need" between the two tags is dynamic, therefor i need a command that will output text from "<--string 1-->" to "<--string 2-->"
Solution
Supposing "the text I need" is just one line, you should check that both string1 and string2 appear (Alex's solution only checks one thing).
A better solution would be:
grep -A 2 "string 1" $file | tail -2 | grep -B 1 "string 2" | head -1
Answered By - davidag Answer Checked By - David Marino (WPSolving Volunteer)