您好,欢迎访问三七文档
当前位置:首页 > 机械/制造/汽车 > 综合/其它 > UE宏命令自动批处理替换文本
UE宏命令自动批处理替换文本[免费下载]在文本编辑过程中,经常有某项工作要多次重复(如连续遍历N次替换文本),这时可以利用UE的宏功能来使其自动执行,以提高效率。宏是将一系列的UE命令和指令组合在一起,形成一组“批处理”命令,以实现任务执行的自动化。1.“宏”菜单“录制”在弹出的对话框中设定快捷键。2.如作查找替换操作,把替换窗口关掉。3.在“宏”菜单,选“停止录制”。关闭UE时间会提示是否保存宏。4.宏”菜单,选“自动加载宏”,设置每次启动自动加载指定宏,只要启动了UE按下快捷键(如Ctrl+M),即自动批处理。解释版(录制后将得到如下类似宏,但没有此处复杂):**Mode//使用**模式ColumnModeOff//关闭列模式HexOff//关闭十六进制模式FindRegExp^interfacePort-channel?//使用正则表达式查找关键字,关键字格式为://行首以interfacePort-channel打头的,后面的?表示匹配除换行符外的任一单个//字符,因为可能是Port-channel1也可能是Port-channel2,所以用?表示IfFound//若找到KeyRIGHTARROW//光标向右移一个字符Start**//开始选择Loop4//循环4次KeyRIGHTARROW//也就是向右移动4个字符EndLoopEnd**//选择4个字符,也就是VLANIDCopy//复制VLANID到剪贴板KeyDOWNARROW//向下移动两行KeyDOWNARROWKeyHOME//光标移到行首encapsulationdot1Q//输入encapsulationdot1Q,注意后有个空格Paste//复制剪贴板中的VLANID到dot1Q后面,从而实现VLANID的复制//两行的双引号,实现换行EndIf如做查找替换文本,以上录制时第一步请先按Ctrl+Home将光标定位到第一行行首,查看宏可以看到增加了Top命令,这在自动批处理替换过程相当重要,至于作用自己去悟,先不要这么做失败了再去这么做了我想你会感谢我。附:本文作者fashio7752的百度知道相关回答:ue中的$如何去掉=1技巧版:1.UE里面替换tab键为空格解决使用UE编辑好且排列整齐的文件在EditPlus中错位的问题。对于已有的带有tab键的空格,若需要将tab键转换为空格,可使用如下方法:1)使用查找替换功能(Ctrl+R),^t表示tab,在出现的窗口中的“查找(N)”输入:^t,“替换为(P)”输入四个空格,全部替换即可。2)中文是工具栏“格式”-“转换制表符为空白”英文是工具栏“format”-“tabtospaces”。若要使新建的文件在UE中编辑时,键入tab键时为4个空格,可选择工具栏选择“高级”-“配置”,勾选“用空格代替制表符”,并将缩进的空格由2改成4即正则表达式(Syntax):%匹配行首-表明要搜索的字符串一定在行首.$匹配行尾-表明要搜索的字符串一定在行尾?匹配除换行符外的任一单个字符.*匹配任意个数的字符出现任意次数(不包括换行符)+匹配前导字符或者表达式出现一次或者更多次(不包括换行符)++匹配前导字符或者表达式不出现或者出现一次以上(不包括换行符)^b匹配页中断符^p匹配DOS文件的换行符^r匹配MAC文件的换行符(CROnly)^n匹配UNIX文件的换行符(LFOnly)^t匹配一个制表符[]匹配方括号中的单个的字符删除空行:替换%[^t]++^p为空串删除行尾空格:替换[^t]+$为空串删除行首空格:替换%[^t]+为空串每行设置为固定的4个空格开头:替换%[^t]++^([~^t^p]^)为^1每段设置为固定的4个空格开头:替换%[^t]+为(如果一行是以空格开始的,则视之为一段的开始行)将一段合并为一行:替换[^t]++^p^([~^t^p]^)为^1(注意:此处假定文本是以DOS方式回车换行-CR/LF)去掉HTMLTAG:替换^{*^}^{*^p*^}为空串删除HTML中的所有:替换[]++a*[]++href[]++=*为空串删除文本中指定的前2列字符:替换%??为空串在第4列后插入2列空白字符:替换%^(????^)^(?^)为^1^2查找所有的数字:[0-9]+[.]++[0-9]+查找所有的单词:[a-z]+查找所有的网址:http://[a-z0-9^~`_./^-^?=&]+UltraEdit宏编辑命令汇总UltraEdit10.0帮助文件EditMacro(Macromenu)TheEditMacrocommandallowsanewmacrotobecreatedandeditedoranexistingmacrothathaspreviouslybeengeneratedwiththiscommandorwiththeMacroRecordcommandtobeedited.Inmanycases,itiseasierfortheusertogeneratethemacrobyrecordingitwiththeMacroRecordcommandandthentoedititifnecessary.Thelearningcurveislesswiththisapproach.CommandsAmacroisaseriesofcommandsthatmaylaterbeplayedbackautomaticallytomodifythefile.Thelefthandsideofthedialogshowsthecurrentmacrobeingeditedandaneditablewindowcontainingthecommandsthatmakeupthemacro.Thecommandsinthemacromustbeoneofthepredefinedcommands.Thesepredefinedcommandsareshownontherighthandsideofthedialog.Ifthemouseisdoubleclickedonthecommanditisautomaticallyaddedtothemacro,orclickingonthearrowtotheleftofthecommandswilladdittothemacro.ParametersManyofthecommandshavenumericparameters.Thenumericparametersarequiteobvious,suchasGotoLine#orGotoPage#.However,someofthecommandssuchasFindandReplace,Sortetc.haveadditionalparametersthatarenotnumeric.Theseadditionalparametersarelistedbelowthecommandlistforeasyselection.CreatingaNewMacroTocreateanewmacrofromthisdialogclicktheNew/Macrobutton.ThisdisplaystheMacroDefinitiondialogallowingyoutodefinethemacronameandhotkeyifrequired.Whenthisnewmacroiscreated,threemacrocommandsareautomaticallyaddedtothemacro:-InsertModeorOverStrikeMode-ColumnModeOnorColumnModeOff-HexOnorHexOffThesethreecommandsareaddedbasedonthecurrentstateoftheeditor.Thepurposeistoestablishaknownstateeachtimethemacroisplayed.Ifamacroisrecordedinonemodeandplayedbackinanothertheresultsmaybeunpredictable.Establishingthemodeatthebeginningofthemacrohelpstoensuretheexpectedresultsareachieved.Thesecommandsmaybemodifiedasrequired.Onceaneditmacrohasbeencreated,itmaybeedited.ModifyingTheMacroTomodifythemacro,commandsmaybetypeddirectlyintothemacroeditboxorselectedfromthecommandlist.Commandsarenotcasesensitivebutmustbespelledexactlyasshowninthecommandlist.Thetablebelowshowsthecommandsthatmaybeaddedtoanyparameters:CommandsParameters*Description1.Inserttextbetweenthequotes().Theclosing2.quotemustbethelastnon-spacecharacterontheline.Thecharactersto3.beinsertedmaycrossmultiplelines.Toinsertaquote(),placeitas4.neededinthetextbeinginsertedandensurethelastcharacterisalsoa5.quote.Toinsertjustonequotecharacter()thelineshouldlooklike6.this:Toinsertanewline,addalinebetweentheopenquoteandclose7.quote.Toinserttwolineswith1and2atthebeginningofthelinesthe8.commandshouldbeasfollows:9.110.211.12.13.AnsiToOemConvertfilefromANSItoOEM.14.15.16.BottomJumptoendoffile.17.18.19.CloseFileBlank(noparameter),Save-forcesthefiletobe20.savedbeforeclosingNoSave?closesthefilewithoutpromptingifthefile21.shouldfirstbesavedClosetheactivefile.22.23.24.ClearClipboardClearthecontentsoftheactive25.clipboardwithinUltraEdit.26.27.28.ClipboardClipboardnumber(0-9)Selectthespecified29.clipboard?0=WindowsClipboardand1-9specifiesuserclipboards.30.31.32.ColumnCenterJustifyCenterjustifyselectedcolumns.33.34.35.ColumnLeftJustifyLeftjustifyselectedcolumns.36.37.38.ColumnRightJustifyRightjustifyselectedcolumns.39.40.41.ColumnModeOffTurnthe
本文标题:UE宏命令自动批处理替换文本
链接地址:https://www.777doc.com/doc-4368882 .html