⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 l5.4

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 4
字号:
#print		    More Alteration - Filtering   One of the most convenient and powerful features of vi is the abilityto take parts of your text and run it through a program.  This is called'filtering' and is quite commonly used with programs like nroff, fmt,spell, sort, uniq, and others.  It is much more convenient to use thisthan to write a portion of the file out, leave the editor, run the programon that portion into a temporary file, re-enter the editor, and read inthe contents of the temporary file.   The filtering command in vi is '!' and it can take any targets that the'd', 'c', 'y', '>', or '<' commands can.  Thus, to run your whole textthrough nroff, you would simply type	1G	To go to the very beginning of the file	!G	To filter the whole file through a program.  Vi will prompt		with a '!' at the bottom of screen.   You type	nroff	and hit return and whammo, off it goes.  Your file will be		replaced by the nroff output.  Use the undo command to go		back to the original text afterwards if you wish.   Type 'ready' to try out this command.#user#create FilterTestEXERCISE	Use the ! command to run the part of this file below the dashed linethrough the program 'sort'.  When you've done that, delete all of theseinstructions, upto and including the dashed line.  Then exit, saving yourchanges.-----------------------------------------------------------------------------to.vax135net.bugs.v7net.rec.scubanet.columbianet.games.trivianet.trivianet.oanet.news.bnet.applicnet.musicnet.miscfa.arms-dfa.railroadfa.arpa-bboardcu.bboardnet.bugs.2bsdnet.bugs.4bsdfa.spacenet.spacenet.eunicenet.rec.bridgenet.cyclecu.games.empirenet.csenet.news.newsitenet.games.roguenet.rec.skydivecu.info-bitgraphnet.mathfa.poli-scinet.generalcu.generalnet.travelnet.sport.baseballto.cornellnet.lang.aplnet.dcomfa.telecomfa.info-cpmnet.langnet.games.pacmannet.aviationnet.ham-radiofa.info-micronet.info-micronet.micronet.rec.photonet.autofa.editor-pfa.digest-pfa.tcp-ipcu.tcp-ipnet.games.dipnet.games.frpnet.lang.lispnet.lispnet.news.groupcu.msggroupnet.followupcu.followupnet.jokes.qnet.rumornet.ucdsnet.unix-wizardsnet.rec.birdsnet.recordsnet.sourcesnet.moviesnet.jokesnet.gamescu.gamesnet.winesnet.taxesnet.bugsnet.periphsnet.cooksfa.worksnet.workscu.worksnet.cmsfa.info-termscu.info-termsfa.sf-loversnet.sf-loversnet.chessfa.human-netscu.localnetsnet.newscu.info-pcnetnet.testnet.auto.vwfa.info-vaxcu.info-vaxnet.usenixnet.unixnet.sport.hockeyfa.energy#create SortedListcu.bboardcu.followupcu.gamescu.games.empirecu.generalcu.info-bitgraphcu.info-pcnetcu.info-termscu.info-vaxcu.localnetscu.msggroupcu.tcp-ipcu.worksfa.arms-dfa.arpa-bboardfa.digest-pfa.editor-pfa.energyfa.human-netsfa.info-cpmfa.info-microfa.info-termsfa.info-vaxfa.poli-scifa.railroadfa.sf-loversfa.spacefa.tcp-ipfa.telecomfa.worksnet.applicnet.autonet.auto.vwnet.aviationnet.bugsnet.bugs.2bsdnet.bugs.4bsdnet.bugs.v7net.chessnet.cmsnet.columbianet.cooksnet.csenet.cyclenet.dcomnet.eunicenet.followupnet.gamesnet.games.dipnet.games.frpnet.games.pacmannet.games.roguenet.games.trivianet.generalnet.ham-radionet.info-micronet.jokesnet.jokes.qnet.langnet.lang.aplnet.lang.lispnet.lispnet.mathnet.micronet.miscnet.moviesnet.musicnet.newsnet.news.bnet.news.groupnet.news.newsitenet.oanet.periphsnet.rec.birdsnet.rec.bridgenet.rec.photonet.rec.scubanet.rec.skydivenet.recordsnet.rumornet.sf-loversnet.sourcesnet.spacenet.sport.baseballnet.sport.hockeynet.taxesnet.testnet.travelnet.trivianet.ucdsnet.unixnet.unix-wizardsnet.usenixnet.winesnet.worksto.cornellto.vax135#vi FilterTest#cmp FilterTest SortedList#succeedQuite impressive!  And you should be impressed too, at how simple it was todo that.   Now you're good enough to go on to the tricky stuff...#failNot quite.  What you need to do is to move the cursor to the first lineafter the dashed line.  Then type '!G' (to tell vi you want to pipe the restof the file through a program).  Vi will prompt at the bottom of the screenand you type 'sort' and hit return.  After a moment, the old, unsorted listshould be replaced by a brand spanking new sorted one (hopefully of the sameelements).  You then go back and delete the instructions (all of them, throughthe dashed line) using the 'dd' command and Voila!, you're done.  Just type:wq to save your changes and exit.When the learn program types a percent sign, just type 'ready' to try it again.#next6.1  10

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -