vi编缉文本文件

如,有以下这几行文本

#define Introduction     1                   //html/ccon001d.htm
#define EnterPassword     2                 //html/ccon001e.htm
#define InstallingTheMcs     5              //html/ccon001h.htm
#define ConfiguringTheMcsComPort     7      //html/ccon001j.htm
#define Bs1200NetworkPlans     10              //html/ccon02gg.htm
#define McsDirectoryWindow     15            //html/ccon02gl.htm
#define SelectingUnits     18                //html/ccon02go.htm
#define EditMenu     19                        //html/ccon02gp.htm
#define TheMcsSetupWizard     20             //html/ccon02i8.htm
#define CreateGroups     23                    //html/ccon02ib.htm

要把它转化成如下文本格式:
Introduction=html/ccon001d.htm
EnterPassword=html/ccon001e.htm
InstallingTheMcs=html/ccon001h.htm
ConfiguringTheMcsComPort=html/ccon001j.htm
Bs1200NetworkPlans=html/ccon02gg.htm
McsDirectoryWindow=html/ccon02gl.htm
SelectingUnits=html/ccon02go.htm
EditMenu=html/ccon02gp.htm
TheMcsSetupWizard=html/ccon02i8.htm
CreateGroups=html/ccon02ib.htm

用vi编缉如下:
:%s/#define//g
:%s/\/\///g
:%s/[0-9]/=/g
:%s/ {1,\}//g
:/%s/[TAB]{1,\}//g
posted @ 2007-06-05 17:37  shipfi  阅读(240)  评论(0编辑  收藏