我的操作系統是Ubuntu的14.04,這裏是我的代碼:我有一個文件dealling:由外殼OUTPUT.TXT但我不知道爲什麼我的代碼無法讀取第一行
while read line
do
awk '{split($0,a,",");print a[6],"qid:"NR,"1:"a[1],"2:"a[2],"3:"a[3],"4:"a[4],"5:"a[5]}'
done < output.txt
我output.txt的是:
0.24056906798291974,0.2640402789853635,-0.15613242425814397,0.27656222925649837,0.24663378435409408,0
-0.16397532884934443,-0.08192444714849861,-0.07868578524120746,-0.13202790903354927,-0.5865884600854129,2
等
和我的輸出是
qid:1 1:-0.16397532884934443 2:-0.08192444714849861 3:-0.07868578524120746 4:-0.13202790903354927 5:-0.5865884600854129
qid:2 1:-0.6359437918203192 2:-0.8776433172563813 3:-0.2684300508327019 4:-0.7212267316402121 5:0.24663378435409408
qid:3 1:0.10572093570549834 2:0.09105791591843243 3:-0.1445154284056035 4:0.024894390454657443 5:0.24663378435409408
第一行已經消失。我找不到爲什麼,有什麼想法?
請格式化你的問題有點 – 2017-04-19 16:33:35