From the Gnuplot documentation:
Command-line substitution is specified by a system command enclosed in backquotes. This command is
spawned and the output it produces replaces the backquoted text on the command line
source: GnuPlot 5.0 documentation
So this can easily be tested in gnuplot itself:
gnuplot> `awk 'BEGIN{print "plot sin(x)"}'`
If you now want to use this with the -e flag from the command-line, it should look something like this:
$ gnuplot --persist -e "`awk 'BEGIN{print \"plot sin(x)\"}' ` "
Notice that we had to escape the <double-quotes> inside the awk command. This is due to bash quoting rules. If you do not want to escape the double quotes, you will have to use single quotes and escape these again. That will than look like this:
$ gnuplot --persist -e '`awk '"'"'BEGIN{print "plot sin(x)"}'"'"' ` '
If you use awk just to generate the data and you want to use the pipe system of gnuplot:
On systems with a popen function, the datafile can be piped through a shell command by starting the file
name with a ’<’. For example,
pop(x) = 103*exp(-x/10)
plot "< awk '{print $1-1965, $2}' population.dat", pop(x)
source: GnuPlot 5.0 documentation
So in case of the OP, with the proper escaping, you would do:
$ gnuplot --persist -e "plot \"< awk '/matchpattern/{print \$4}' log.txt \""
notice how I also had to escape the $, otherwise, bash would have substituted it with the 4th bash argument which is most likely an empty string.