Saturday, 24 August 2013

Linux shell, get all the matches from a file

Linux shell, get all the matches from a file

I have a file like the following format:
line one
line two <% word1 %> text <% word2 %>
line three <%word3%>
I want to use linux shell tools like awk, sed etc to get all the words
quoted in <% %>
result should be like
word1
word2
word3
Thanks for help.
I forgot to mention: I am in embedded environment. grep has no -P option

No comments:

Post a Comment