是不是这个意思?
javalee//home/javalee/lx>cat data
Mike Harrington:[510) 548-1278:250:100:175
Christian Dobbins:[408) 538-2358:155:90:201
Susan Dalsass:[206) 654-6279:250:60:50
Archie McNichol:[206) 548-1348:250:100:175
Jody Savage:[206) 548-1278:15:188:150
Guy Quigley:[916) 343-6410:250:100:175
Dan Savage:[406) 298-7744:450:300:275
Nancy McNeil:[206) 548-1278:250:80:75
John Goldenrod:[916) 348-4278:250:100:175
Chet Main:[510) 548-5258:50:95:135
Tom Savage:[408) 926-3456:250:168:200
Elizabeth Stachelin:[916) 440-1763:175:75:300
javalee//home/javalee/lx>awk -F: '{name[x++]=$1};END{for(i=0;i<NR;i++)print i,name}' data >tmp #取文件中$1域中的值作为数组,在输出到文件tmp中
javalee//home/javalee/lx>cat tmp
0 Mike Harrington
1 Christian Dobbins
2 Susan Dalsass
3 Archie McNichol
4 Jody Savage
5 Guy Quigley
6 Dan Savage
7 Nancy McNeil
8 John Goldenrod
9 Chet Main
10 Tom Savage
11 Elizabeth Stachelin