I have a file containing three kinds of lines:
[ ] APPLE
[ORANGE ] * ORANGE on XXXXXXXXXXXXXXX
[YELLOW ] + BANANA on XXXXXXXXXXXXXXX
What I want to do now is to extract the fruit name like below:
APPLE
ORANGE
BANANA
I tried to extract it with echo ${line:start:end} before I realized both the length of the line might vary. So I guess I have to do it with pattern matching.
I'm new to bash, how should I extract the fruit name, with sed/awk or any other ways?
Thanks!
SERVICE11 or SERVICE23 or SERVICE999999(just for a few possible examples). Please update your question with this information, rather than replying in a comment thread. Good luck.