![]() * In this context, underscore (the “_” character) counts as a letter. Note that this will now not match Cat and elephants live in different environmentsbecause the word “elephants” is not the same as the word “elephant”. It basically disallows matches of the given patten when the matching string is part of a longer word. (I’m not sure whether this is POSIX-compliant.) The -w option is an extension of the POSIX standard for grep, but is implemented by most common grep implementations. \W matches a non-word character (i.e., a space (or tab) To be preceded by a non-word character (or the beginning of the line)Īnd followed by a non-word character (or the end of the line). ![]() If you want to avoid this, try awk '/(^|\W)(\W|$)/
0 Comments
Leave a Reply. |