0
I would like to assign variable result of system function:
awk 'BEGIN{x=system("cut -d \" \" -f 1 ol");print x}'
Input "ol":
1
Result:
1
0
0
I would like to assign variable result of system function:
awk 'BEGIN{x=system("cut -d \" \" -f 1 ol");print x}'
Input "ol":
1
Result:
1
0
1
I don't think there is a direct easy way to do that. You have to fall back on temporary files or on this method (contents of 'input': "value in ol"):
awk -v cut_result=$( awk 'BEGIN{system("cut -d \" \" -f 1 ol")}' ) '{print $0, cut_result}' input
result: "value in ol 1"
So the output of awk is turned into a variable that's fed into another invocation of awk as the variable "cut_result".