File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / usr / src / usr.lib / learn / editor / L38.1a
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:24:19 2019 UTC (7 years ago) by root
Branches: bsd, MAIN
CVS tags: v12b, v121, HEAD
Power 6/32 Unix version 1.2b

#print
Sometimes it is desirable to specify that
the characters to be changed are at the beginning
of the line.  This uses the '^' character.  For example,
  s/^ab/xy/p
will change "ab" to "xy" ONLY if "ab" begins the line.
Remember that 
  s/ab/xy/p
would just change the first "ab" anywhere in the line.
In this directory there is a file "text"; whenever the
letters "cat" begin a line, change them to "mouse; but leave
other instances of "cat" unaltered.  Do this on each line (it only
takes one command, as you know).  Then rewrite the file and
type "ready".
#create Ref
mouse's paw
alley cat
mouse has nine lives
let the cat out of the bag
#create text
cat's paw
alley cat
cat has nine lives
let the cat out of the bag
#user
#cmp Ref text
#log
#next
39.1a 10

unix.superglobalmegacorp.com

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