Hi,
I'm struggling with a regex that would match a 'b' that follows an 'a' and is at the end of a string of non-white characters. For example:
Line 1: aba abab b abb aab bab baa
I can find the right strings but I'm lacking knowledge of how to "discard" the bits that precede bs.
Any idea?
Try this:
awk '{for(i=1;i<=NF;i++){if($i ~ "ab$"){print $i}}}'
Regards
Thank you for your reply, not quite what I was looking for, though. I was looking for something that was not specifically for awk, like:
\<[^\t\n\f\r ]*ab\>
But I wanted to find just parts of strings (last 'b's) which was wrong in the first place as regular expressions are meant to find *whole* strings. D'oh! Oh man, where did I get that idea from... (o: