Reference no: EM136901
What if we need the portion from a text based on some keyword.
For eg. My file is like below,
------------------------------------------------
Order=[<order id="EO427849240">
1
2
3
4
5
Order=[<order id="EO427849241">
6
7
8
9
10
Order=[<order id="EO427849242">
11
12
13
14
15
Order=[<order id="EO427849243">
------------------------------------------------
Now i want the middle portion where i found EO427849242. I tried with sed but it does not give me the desired result.
I used the command,
sed -n '/Sandy Order/,/Sandy Order/p' Filename
and it gives me the all the portion in the file from Start=Sandy Order and end=Sandy Order
When I use the below command,
sed -n '/Sandy Order/,/Sandy Order/p' Filename | grep EO427849242
it only gave me the line
Order=[<order id="EO427849242">
But what i need is
-----
Order=[<order id="EO427849242">
11
12
13
14
15
-----
Can anyone please help me on this. It will be really helpful.