Reputation: 411
Hi all, I am using awk in order to print the output, sort them and then store it in a file but when I insert the sort command I am getting a syntax error.. Here is my below code .. Could you ppl please let me know If I am going the things correctly
CODE
id !~ /^\s*$/){print id,ip[id];}|sort -k 1 > "file"} for (key in h) {split(key,values," "); if(values[1] !~ /^\s*$/ && values[2] !~ /^\s*$/){print values[1],values[2],h[key]}|sort -k 1 -k 2 > "file"}}
awk: ^ syntax error
Upvotes: 1
Views: 192
Reputation: 143102
This should work, change:
... | sort -k 1 > "file" } ...
to
... | "sort -k 1 > file" } ...
and the same change for your other sort
. I.e., enclose your whole sort
command inside double quotes.
Upvotes: 1