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*

3
  • 2
    What you're searching for is not text that matches a "pattern", it's text that matches either a string or a regular expression. See how-do-i-find-the-text-that-matches-a-pattern for why that matters and why you shouldn't use the word "pattern" in this context. Commented May 26, 2021 at 15:23
  • 1
    See also how-do-i-use-shell-variables-in-an-awk-script for a comprehensive answer to the question of how to pass the value of shell variables or other values to an awk script. Commented May 26, 2021 at 16:05
  • 1
    I've been reading a lot of info about awk and passing variables, etc. topics so apologies if I am a bit confused, but, although above answers are very good, IMO, fail to address one of OPs questions, whether it is possible or not to use "/search/" as variable. To me it sounds it is not possible, but I fail to see why or where is this stated Commented Aug 10, 2022 at 9:55