Is there a way to put awk or other shell commands inside a gnuplot function?
I know I could outsource the awk script to another file and awk this file directly after plot, but I don't want separate files.

*Note that this doesn't actually execute the command. It just builds the string which will be passed to plot and then plot will execute the command. If you actually want to execute a command in a function, you can call system as a function. From the docs:

`system "command"` executes "command" using the standard shell. See `shell`.
If called as a function, `system("command")` returns the resulting character
stream from stdout as a string. One optional trailing newline is ignored.
This can be used to import external functions into gnuplot scripts:
f(x) = real(system(sprintf("somecommand %f", x)))