[PLUG] Bash variable substitutions for awk...
Scott Bigelow
epheph at gmail.com
Wed Mar 29 13:57:31 UTC 2017
I'm not super clear on what you're trying to accomplish, but I might
suggest attacking the quoting instead of doing something awk-specific.
awk -F "\",\"" '{ print '$each', $30, $33 }' ${input file}
so long as you don't put a space between the end single quote and the
beginning of a variable or other quoting mechanism, it is interpreted as a
single argument.
On Wed, Mar 29, 2017 at 5:53 AM, Rich Shepard <rshepard at appl-ecosys.com>
wrote:
> On Tue, 28 Mar 2017, Russell Senior wrote:
>
> > If you want to use an external variable inside an awk script, you
> > generally need to use the -v var=val or (long) --assign=var=val command
> > line options. See --help or the appropriate manpage for details.
> Something
> > like (not tested):
> >
> > awk -v each=${each} '$32 == each { print ... }' ${inputfile}
>
> Would the pattern match syntax, ${each} ~ $32, also work?
>
> Rich
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
More information about the PLUG
mailing list