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*

8
  • 3
    Did you test this before posting? Your advice about passing variables with -v is good, but the usages /$VAR/ and print "$var" will fail I think Commented May 18, 2016 at 13:20
  • 1
    Yep there are two variables, and you do not wnat the " or $ in front of var :) Commented May 18, 2016 at 13:26
  • ... and AFAIK you can't use variables inside a /.../ regex match: use $0 ~ var instead Commented May 18, 2016 at 13:29
  • 1
    yeah you are right. I haven't tested. corrected post Commented May 18, 2016 at 13:38
  • 1
    You cannot :) you have to break the single quotes first.. if you look closely in my post you will see the " is before the break in the single quote block so that the awk script sees the " in its script, you then break the single quote block, use the terminal variable which will be textually replaced reopen the single quotes close the double quotes and finish the awk script :) Narly but it works :) Commented May 18, 2016 at 13:44