Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • The awk(1) manpage makes a distinction between a regular expression and a pattern, and gives a clear definition of what it considers a "pattern". Quote: "Patterns are arbitrary Boolean combinations (with ! || &&) of regular expressions and relational expressions." Commented Jun 8 at 15:17
  • @Vilinkameni yeah, they're trying to redefine the meaning of the word "pattern" to mean what the word "condition" already means so as to not invalidate 50 years of documentation (and, presumably, comments in code). But "pattern" hasn't been the right word for what that construct is used for in awk for about 40 of those 50 years so IMO it's long past time to get over it and just start talking about "conditions" so people new to awk aren't always scratching their head about the word "pattern" and needing to read a non-dictionary re-definition of it to understand its intent in awk. Commented Jun 8 at 15:24
  • Everyone understands what a "pattern" is. Everyone understands what a "condition" is. When I write if ( foo ) { bar() } everyone knows that foo is a "condition". There is no reason to re-define it as being a "pattern" and then have to explain what we mean by "pattern" in this context when we use it in an awk script as foo { bar() } which is simply shorthand for if ( foo ) { bar() } - foo didn't change. Commented Jun 8 at 15:28
  • There in customarily more text on the line following ### DK Commented Jun 8 at 15:43
  • OK, I changed $NF to $2 and == "DK" to ~ /^DK/ in my code. Commented Jun 8 at 16:19