home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 September / Simtel20_Sept92.cdr / msdos / editor / ws_train.arc / EX6.WS < prev    next >
Text File  |  1986-09-15  |  7KB  |  163 lines

  1.               EXERCISE 6:  SEARCHING AND REPLACING
  2.  
  3.      Iε thi≤ exercise¼ yo⌡ wil∞ learε ho≈ t∩ searcΦ througΦ ß ì
  4. documen⌠ fo≥ ß specifieΣ worΣ o≥ othe≥ strinτ oµ characters«  A≤ ì
  5. yo⌡ migh⌠ guess¼ tha⌠ i≤ ver∙ hand∙ wheε yo⌡ arσ doinτ ì
  6. corrections¼ anΣ wan⌠ t∩ ski≡ quickl∙ t∩ thσ nex⌠ erro≥ iε thσ ì
  7. documen⌠ withou⌠ scrollinτ t∩ it«  
  8.  
  9.      Iε additioε t∩ jus⌠ searchinτ fo≥ ß word¼ thσ prograφ caε ì
  10. searcΦ fo≥ ß worΣ anΣ theε replacσ i⌠ witΦ another«  Tha⌠ i≤ ì
  11. hand∙ fo≥ sucΦ thing≤ a≤ correctinτ systematiπ spellinτ o≥ ì
  12. capitalization error≤ o≥ fo≥ expandinτ abbreviations«  
  13.  
  14.      BotΦ simplσ searchinτ anΣ searchinτ witΦ replacemen⌠ arσ ì
  15. usefu∞ fo≥ completinτ pre-writteε skeletoε documents.
  16.  
  17. SEARCHING
  18.  
  19.      Let'≤ star⌠ witΦ thσ simplσ searcΦ command¼ Ctrl-q-f«  Wheε ì
  20. yo⌡ givσ thi≤ command¼ thσ prograφ prompt≤ you¼ askinτ wha⌠ yo⌡ ì
  21. wisΦ t∩ searcΦ for«  Yo⌡ theε ente≥ thσ worΣ o≥ othe≥ characte≥ ì
  22. strinτ tha⌠ yo⌡ arσ lookinτ fo≥ anΣ arσ askeΣ choosσ froφ severa∞ ì
  23. options«  Thσ firs⌠ timσ yo⌡ tr∙ it¼ jus⌠ hi⌠ "Enteró agaiε wheε ì
  24. askeΣ fo≥ options.
  25.  
  26.      Okay¼ no≈ tr∙ it (read through the instructions first):
  27.  
  28.      1.  First¼ movσ thσ curso≥ t∩ thσ star⌠ oµ thi≤ screenful∞ ì
  29. áááááááááb∙ hittinτ thσ "Homeó key.
  30.  
  31. ááááá2.  Now give the search command Ctrl-q-f.
  32.  
  33.      3«  Wheε askeΣ wha⌠ yo⌡ wan⌠ t∩ find¼ typσ: hoho«           ì
  34. ááááá ááá(use lower case letters, the program is picky).
  35.  
  36. ááááá4«  Remembe≥ t∩ jus⌠ hi⌠ thσ "Enteró ke∙ wheε askeΣ fo≥ ì
  37. ááááá    options.
  38.  
  39.      5.  Thσ curso≥ wil∞ jum≡ straigh⌠ t∩ thσ worΣ "hoho.ó  Iµ    ì
  40. áááááááááyo⌡ don'⌠ seσ wha⌠ i≤ happening¼ tr∙ i⌠ again¼ theε ì
  41. ááááááááácontinuσ readinτ thσ exercise.
  42.  
  43.      What happened when you searched for the word "hoho?"  (1)
  44.  
  45.      Where did the search begin?  (2)
  46.  
  47. REPEATING A SEARCH
  48.  
  49.      Oncσ thσ character≤ yo⌡ arσ searchinτ fo≥ havσ beeε ì
  50. specified¼ yo⌡ caε repea⌠ thσ searcΦ witΦ ß simplσ Ctrl-∞ ì
  51. command«  Sincσ wσ havσ alread∙ specifieΣ thσ worΣ "hohoó a≤ ou≥ ì
  52. searcΦ pattern¼ movσ thσ curso≥ t∩ beginninτ oµ thi≤ paragraph¼ ì
  53. anΣ hi⌠ Ctr-∞ ß fe≈ times.
  54.  
  55.      hoho hoho hoho hoho hoho hoho hoho hoho hoho è     hoho hoho hoho hoho hoho hoho hoho hoho hoho
  56.  
  57.      A≤ yo⌡ see¼ eacΦ subsequen⌠ Ctrl-∞ move≤ thσ curso≥ t∩ thσ ì
  58. nex⌠ occurrencσ oµ thσ worΣ "hoho."
  59.  
  60. NOT JUST WHOLE WORDS
  61.  
  62.      Yo⌡ arσ no⌠ restricteΣ t∩ searche≤ fo≥ wholσ words«  I⌠ i≤ ì
  63. possiblσ t∩ searcΦ fo≥ an∙ combinatioε oµ characters«  Fo≥ ì
  64. instance¼ wha⌠ happen≤ iµ yo⌡ movσ thσ curso≥ t∩ thσ beginninτ oµ ì
  65. thi≤ paragrapΦ theε initiatσ ß searcΦ fo≥ thσ strinτ "σ s"« (3)
  66.  
  67. SORRY, NO MATCH
  68.  
  69.      A⌠ time≤ yo⌡ wil∞ givσ ß commanΣ t∩ searcΦ fo≥ ß certaiε ì
  70. word¼ bu⌠ i⌠ wil∞ no⌠ bσ found«  Fo≥ instance¼ yo⌡ wil∞ bσ glaΣ ì
  71. t∩ hea≥ tha⌠ therσ arσ n∩ morσ "hohosó iε thi≤ exercise«  Wha⌠ ì
  72. woulΣ happeε iµ yo⌡ placeΣ thσ curso≥ a⌠ thσ enΣ oµ thi≤ ì
  73. paragrapΦ anΣ gavσ thσ commanΣ t∩ searcΦ fo≥ tha⌠ word┐ (4⌐  Tr∙ ì
  74. i⌠ anΣ seσ wha⌠ happens¼ theε returε t∩ thi≤ poin⌠ anΣ continuσ ì
  75. thσ exercise.
  76.  
  77. REPLACEMENT
  78.  
  79.      A≤ mentioneΣ above¼ yo⌡ caε specif∙ ß worΣ o≥ strinτ oµ ì
  80. character≤ t∩ bσ substituteΣ fo≥ thσ searcΦ strinτ wheε i⌠ i≤ ì
  81. found«  Thσ commanΣ fo≥ searchinτ witΦ replacemen⌠ i≤ Ctrl-q-a«  ì
  82. Wheε yo⌡ hi⌠ Ctrl-q-a¼ yo⌡ arσ askeΣ fo≥ ß botΦ searcΦ patterε ì
  83. anΣ ß replacement.
  84.  
  85.      Wheε ß matcΦ i≤ found¼ thσ prograφ stop≤ anΣ ask≤ yo⌡ t∩ ì
  86. verif∙ tha⌠ yo⌡ wan⌠ thσ replacemen⌠ t∩ bσ made«  (Thσ promp⌠ ì
  87. appear≤ a⌠ thσ righ⌠ sidσ oµ thσ to≡ linσ oε thσ screen).
  88.  
  89.      M∙ namσ i≤ iε thσ sentencσ followinτ thi≤ paragraph«  Usσ ì
  90. thσ Ctrl-q-ß commanΣ t∩ replacσ i⌠ witΦ yours«  Don'⌠ forge⌠ t∩ ì
  91. capitalizσ thσ firs⌠ lette≥ oµ m∙ name¼ o≥ thσ searcΦ won'⌠ matcΦ ì
  92. exactly¼ and¼ again¼ jus⌠ hi⌠ "Enteró wheε askeΣ fo≥ options« 
  93.  
  94.      My name is Larry.  
  95.  
  96. MULTIPLE REPLACEMENT
  97.  
  98.      A≤ yo⌡ migh⌠ guess¼ thσ repea⌠ command¼ Ctrl-l¼ caε bσ useΣ ì
  99. t∩ repea⌠ searche≤ witΦ replacemen⌠ a≤ wel∞ a≤ simplσ searches«  ì
  100. Movσ thσ curso≥ t∩ thσ beginninτ oµ thi≤ paragrapΦ anΣ hi⌠ Ctrl-∞ ì
  101. ß fe≈ times«  Don'⌠ forge⌠ tha⌠ yo⌡ wil∞ havσ t∩ authorizσ eacΦ ì
  102. replacemen⌠ oµ m∙ namσ wheε i⌠ i≤ found.
  103.  
  104.      Larry Larry Larry Larry Larry Larry Larry Larry
  105.  
  106. THE OPTIONS
  107.  
  108.      A≤ yo⌡ havσ noticed¼ severa∞ option≤ arσ availablσ wheneve≥ ì
  109. yo⌡ givσ thσ searcΦ o≥ searcΦ anΣ replacσ commands«  Iµ yo⌡ hi⌠ ìèthσ "?ó wheε prompteΣ fo≥ aε option¼ the∙ arσ explained¼ a≤ ì
  110. follows:
  111.  
  112.      b - search backward from the cursor position, not forward
  113. áááááw - search for whole words only
  114. áááááu - ignore cases of letters
  115. áááááε - replacσ automatically¼ withou⌠ askinτ thσ questioε ì
  116. ááááá  ááREPLAC┼ Y/N?
  117. ááááág - replace in the entire file, not just the first match
  118.  
  119.      Yo⌡ caε als∩ ente≥ ß number«  A≤ yo⌡ wil∞ seσ below¼ thσ ì
  120. meaninτ oµ thσ numbe≥ optioε i≤ differen⌠ dependinτ upoε whethe≥ ì
  121. i⌠ i≤ useΣ witΦ thσ simplσ searcΦ commanΣ o≥ thσ searcΦ anΣ ì
  122. replace.
  123.  
  124. TRYING THE OPTIONS OUT
  125.  
  126.      Try using these options a little -- 
  127.  
  128.      M∙ namσ i≤ Larry«  Wha⌠ happen≤ iµ yo⌡ searcΦ thi≤ paragrapΦ ì
  129. fo≥ thσ worΣ "larryó witΦ thσ "uó optioε selected┐ (5)
  130.  
  131.      Wha⌠ happen≤ iµ yo⌡ searcΦ fo≥ m∙ namσ startinτ a⌠ thi≤ ì
  132. paragrapΦ witΦ thσ "bó optioε selected┐  (6⌐  Wha⌠ iµ yo⌡ theε ì
  133. repea⌠ thσ searcΦ severa∞ time≤ usinτ Ctrl-l┐ (7)
  134.  
  135.      Mos⌠ oµ thσ option≤ havσ thσ samσ meaninτ whethe≥ useΣ iε ß ì
  136. simplσ search¼ Ctrl-q-f¼ o≥ ß searcΦ witΦ replacement¼ Ctrl-q-a«  ì
  137. However¼ thσ optioε wherσ yo⌡ specif∙ ß numbe≥ differs«  If¼ fo≥ ì
  138. example¼ yo⌡ specif∙ thσ numbe≥ │ a≤ aε optioε witΦ ß simplσ ì
  139. search¼ thσ thirΣ occurrencσ oµ thσ searcΦ worΣ wil∞ bσ ì
  140. found¼ no⌠ thσ first«  Thσ numbe≥ optioε ha≤ ß differen⌠ ì
  141. meaninτ witΦ thσ searcΦ anΣ replacσ command«  Caε yo⌡ figurσ ì
  142. ou⌠ wha⌠ i⌠ is┐ (8)
  143.  
  144.      Wha⌠ happen≤ iµ yo⌡ tr∙ t∩ combinσ options┐  Fo≥ instancσ ì
  145. wha⌠ happen≤ iµ yo⌡ selec⌠ botΦ "bó anΣ "u?ó  (9⌐ 
  146.  
  147. RECAPPING
  148.  
  149.      Yo⌡ caε searcΦ througΦ ß documen⌠ fo≥ ß specifieΣ worΣ o≥ ì
  150. characte≥ pattern«  Yo⌡ caε als∩ replacσ thσ specifieΣ patterε ì
  151. witΦ somσ othe≥ character≤ wheε i⌠ i≤ found«  Therσ i≤ ß third¼ ì
  152. related¼ commanΣ whicΦ repeat≤ thσ las⌠ searcΦ o≥ searcΦ witΦ ì
  153. replacement.
  154.  
  155.      The three commands we learned were:
  156.  
  157.           Ctrl-q-f
  158. ááááááááááCtrl-q-a
  159. ááááááááááCtrl-l
  160.  
  161.      Iε addition¼ severa∞ option≤ o≥ modifier≤ arσ availablσ fo≥ ì
  162. thσ searcΦ anΣ searcΦ anΣ replacσ commands«  The∙ arσ b¼ w¼ u¼ n¼ ì
  163. g¼ anΣ an∙ number«  Thesσ option≤ ma∙ bσ combineΣ a⌠ will.