這裏是我的代碼打印出在編號格式我的文字:如何使用awk和printf從0而不是1對文本進行編號?
awk '{printf("%s \"%d\" \n" ,$0 , NR)}' mapcycle_surf1.txt
輸出:
"surf_004_final1" "1"
"surf_1day" "2"
"surf_2012_beta12" "3"
"surf_3" "4"
如何啓動編號計數從0而不是1這樣的:
"surf_004_final1" "0"
"surf_1day" "1"
"surf_2012_beta12" "2"
"surf_3" "3"
用'NR-1'代替? –
真棒工作! – Infinite