Annotation of 42BSD/usr.lib/learn/editor/L41.1a, revision 1.1.1.1

1.1       root        1: #print
                      2: One thing you must be careful of is that the substitute command does not
                      3: know about word boundaries.  It will change the first occurrence of a
                      4: letter string it matches without regard to blanks or punctuation around it.
                      5: Thus, if the current line is
                      6:    i would rather be the king
                      7: and you type
                      8:    s/the/a/p
                      9: you get
                     10:    i would raar be the king
                     11: instead of
                     12:    i would rather be a king
                     13: Right?  You should always print lines after changing them to avoid
                     14: missing such errors.  You can defend against them by increasing the
                     15: amount of context you specify; in this case, for example, you could say
                     16:    s/the /a /p
                     17: and get
                     18:    i would rather be a king
                     19: Often the "$" operator is useful here, if you want to change the last
                     20: thing on the line.  In the file 'text', the third line reads
                     21:    never, never, never, never, never
                     22: Edit this file to make the third line read
                     23:   never, never, never, never, or hardly ever
                     24: Rewrite the file and type "ready".
                     25: #create Ref
                     26: why should a dog, a horse, a rat, have life,
                     27: and thou no breath at all? thou'lt come no more,
                     28: never, never, never, never, or hardly ever
                     29: pray you, undo this button.  thank you, sir.
                     30: #create text
                     31: why should a dog, a horse, a rat, have life,
                     32: and thou no breath at all? thou'lt come no more,
                     33: never, never, never, never, never
                     34: pray you, undo this button.  thank you, sir.
                     35: #user
                     36: #cmp text Ref
                     37: #log
                     38: #next
                     39: 42.1a 10
                     40: 41.1b 5
                     41: 42.2a 6

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.