[ Pobierz całość w formacie PDF ]
.You can then paste thecontents just as you had when copying the text into the desired position."add Delete the line and place it into named buffer a."a4dd Delete 4 lines and place into named buffer a.dw Delete a word and place into unnamed buffer 140 APPENDIX A.INTRODUCTION TO VISee the section on modifying text for more examples of deleting text.On the event of a system crash the named and unnamed bu er contents are lost but the editbu ers content can be recovered See Usefull commands.A.4.4 Searching and replacing textvi has a number of search command.You can search for individual charaters through to regularexpressions.The main two character based search commands are f and t.fc Find the next character c.Moves RIGHT to the next.Fc Find the next character c.Moves LEFT to the preceding.tc Move RIGHT to character before the next c.Tc Move LEFT to the character following the preceding c.Some clones this is the same as Fc; Repeats the last f, F, t, T command, Same as ; but reverses the direction to the orginal command.If the character you were searching for was not found, vi will beep or give some other sort ofsignal.vi allows you to search for a string in the edit bu er.str Searches Right and Down for the next occurance of str.?str Searches Left and UP for the next occurance of str.n Repeat the last or ? commandN Repeats the last or ? in the Reverse direction.When using the or ? commands a line will be cleared along the bottom of the screen.Youenter the search string followed by RETURN.The string in the command or ? can be a regular expression.A regular expression isa description of a set of characters.The description is build using text intermixed with specialcharacters.The special characters in regular expressions are.* ^$.Matches any single character except newline.Escapes any special characters.* Matches 0 or More occurances of the preceding character.Matches exactly one of the enclosed characters.^ Match of the next character must be at the begining of the line.$ Matches characters preceding at the end of the line.^ Matches anything not enclosed after the not character.- Matches a range of characters.The only way to get use to the regular expression is to use them.Following is a series of examples. A.4.ADVANCED VI TUTORIAL 141c.pe Matches cope, cape, caper etcc.pe Matches c.pe, c.per etcsto*p Matches stp, stop, stoop etccar.*n Matches carton, cartoon, carmen etcxyz.* Matches xyz to the end of the line.^The Matches any line starting with The.atime$ Matches any line ending with atime.^Only$ Matches any line with Only as the only word in the line.b aou rn Matches barn, born, burn.Ver D-F Matches VerD, VerE, VerF.Ver ^1-9 Matches Ver followed by any non digit.the ir re Matches their, therr, there, theie.A-Za-z A-Za-z * Matches any word.vi uses ex command mode to perform search and replace operations.All commands which startwith a colon are requests in ex mode.The search and replace command allows regular expression to be used over a range of lines andreplace the matching string.The user can ask for con rmation before the substitution is performed.It may be well worth a review of line number representation in the ed tutorial.: start , finish s find replace g General command: 1, $s the The g Search the entire file and replace the with The.: s the The g means the complete file.Same as above.:., 5s ^.* g Delete the contents from the current to 5th line.: s the The gc Replace the with The but ask before substituting.: s ^.g Delete the first four characters on each line.The search command is very powerfull when combined with the regular expression search strings.If the g directive is not included then the change is performed only on the rst occurance of amatch on each line.Sometimes you may want to use the original search string in the replacement result.You couldretype the command on the line but vi allows the replacement string to contain some specialcharacters.: 1, 5s help &ing g Replaces help with helping on the first 5 lines.: s * && g Double the number of spaces between the words [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • hanula1950.keep.pl