0
我有一個awk的代碼合併2個文件,並將結果添加到使用file.txt的結束「>>」放AWK代碼和排序結果
我的代碼
NR==FNR && $2!=0 {two[$0]++;j=1; next }{for(i in two) {split(i,one,FS); if(one[3] == $NF){x=$4;sub(/[[:digit:]]/, "A", $4); print j++,$1,$2,$3,x,$4 | "column -t" ">>" "./Desktop/file.txt"}}}
我希望把我的awk來bash腳本和finaly排序我的file.txt的,並保存排序結果,再次使用FILE.TXT >
我想這
#!/bin/bash
command=$(awk '{NR==FNR && $2!=0 {two[$0]++;j=1; next }{for(i in two) {split(i,one,FS); if(one[3] == $NF){x=$4;sub(/[[:digit:]]/, "A", $4); print $1,$2,$3,$4 | "column -t" ">>" "./Desktop/file.txt"}}}}')
echo -e "$command" | column -t | sort -s -n -k4 > ./Desktop/file.txt
但它給我錯誤"for reading (no such a file or directory)"
我的錯誤在哪裏?
在此先感謝
你能舉出輸入文件和預期結果的例子嗎? –