(Li|U)nix: grep, part 4: back to Earth
Self-tutoring about computer science: the tutor continues about grep.
I mention back in my post from March 20, 2021 that on one system I use, grep handles the character classes \d and \w. Yet, one can’t count on all systems doing so.
Today I was using one in which grep wouldn’t work with \d or \w, but insisted on the character classes [[:digit:]], [[:alpha:]], [[:alnum:]], and so on. These are obviously not so convenient as Perl character classes (such as \d and \w); furthermore, [[:digit:]] is probably less convenient than [0-9]. \d and \w are big advantages of Perl regular expressions, which grep, by itself, isn’t expected to support.
I’ve read some people mention they use [:alpha:] and [:digit:] rather than the double-layer brackets. However, the double-layer brackets I find to be reliable, while [:digit:] or [:alpha:] only work sometimes. Such is my experience, anyway.
I’ll be posting more about grep, I expect:)
Source:
Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.