そのため、8 番目の列に基づいて、かなり大きなファイルをいくつかの小さなファイルに分割したいと考えています。だから私はこのスクリプトを書いた:
#!/bin/bash
run_command(){
eval ${1}
wait
}
chInput=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "Z" "T" "G" "F" "A" "D" "P")
sampInput=("heyA")
for ((x=0;x<${#chInput[@]};x++));do
com="awk -F'\t' '$8=="${chInput[x]}"' /home/location/"$sampInput"_This_P.txt > "$sampInput"Ch"${chInput[x]}".txt"
run_command "${com}"
done
しかし、それは機能していません
'$8==
awk: ==1
awk: ^ syntax error
awk: ==2
awk: ^ syntax error
awk: ==3
awk: ^ syntax error
awk: ==4
awk: ^ syntax error
でもやってるだけ
awk -F'\t' '$8==1' /home/location/heyA_This_P.txt > Ch1.txt
コマンドラインからはうまくいきました
この問題を解決するにはどうすればよいですか?