- 论坛徽章:
- 145
|
回复 1# oldknew
$ awk -vs="4,7,2,5" 'function chg(n,m,t){t=a[n];a[n]=a[m];a[m]=t}{a[NR]=$0}END{t=split(s,b,",");for(n=1;n<t;n+=2)chg(b[n],b[n+1]);for(n=1;n<=NR;++n)print a[n]}' databook1
1 Steve Blenheim:238-923-7366:95 Latham Lane
5 Jennifer Cowan:548-834-2348:583 Laurel Ave.
3 Igor Chevsky:385-375-8395:3567 Populus Place
7 Karen Evich:284-758-2857:23 Edsadcliff Place--(替换行之前)
2 Betty Boop:245-836-8357:635 Cutesy Lane
6 Jon DeLoach:408-253-3122:123 Park St.
4 Norma Corder:397-857-2735:74 Pine Street--(替换行之前)
8 taden Esich:284-758-28de:23 Edsdkskdliff Place
9 Karen Evych:284-743-2867:23 Edgecliff Place
|
|