How to execute (./myscript) inside awk or bash script?

前端 未结 3 1240
逝去的感伤
逝去的感伤 2021-01-23 09:39

I would like to run a script within an awk command. I have a code ./myscript that calculates the likelihood between two entities; the results are listed in listfile.txt.

3条回答
  •  有刺的猬
    2021-01-23 10:22

    Use awk's system() function:

    Here an example

    awk '{printf("%s ",$1); system("myscript " $2)}' file
    

    the example is from this site https://unix.stackexchange.com/questions/72935/using-bash-shell-function-inside-awk

提交回复
热议问题