You just put all of the
awk statements within the program text on the command line:
Code:
awk 'BEGIN { offset = 72 }
function f(x) { return (x > offset ? x-offset-1 : x+100-offset-1) }
{ print f($17)" "strtonum($14) }' fll.dat | sort -g | uniq > phase.dat
I've broken up the
awk statements on multiple lines for readability. You can leave them that way, or smoosh them all together on one line -- your choice, makes no difference.
You could also pass that offset value in as a parameter rather than setting it in the BEGIN block. That way it could be a shell variable:
Code:
#!/bin/bash
Offset=72
awk -v offset=$Offset 'function f(x) { return (x > offset ? x-offset-1 : x+100-offset-1) }
{ print f($17)" "strtonum($14) }' fll.dat | sort -g | uniq > phase.dat