方法一: awk '{printf("%d,%s\n",NR,$0)}' filename 方法二: cat -n filename 方法三: nl filename 转载于:https://blog.51cto.com/mooon/908684