I am tying to grep from the below
I am trying:
$ echo ''| grep -o "]>"
I am getting the above. So how to get only
Answer
echo ''| grep -o "]*>"
Your .*
is greedy, it matched the first >
and beyond. My [^>]*
is also greedy, but it cannot match anything that includes >
, so >
in the pattern matches the first occurrence of >
in the input for sure.
No comments:
Post a Comment