blank.gif (43 bytes)

Church Of The
Swimming Elephant

Search:
index.gif

ntcmds00000000.gif

Edlin: R (Replace)--Examples

Suppose you want Edlin to carry out only each confirmed replacement of the word "mine" with the word "ours" within the first 20 lines of the edited file in memory. Type the first part of the command as follows, but do not press ENTER:

1,20?rmine

To complete the command, press CTRL+Z (which appears on the screen as ^Z), type the word ours, and press ENTER. The complete command appears on the screen as follows:

1,20?rmine^Zours

Suppose that the following file is in memory and ready to edit. You can type 1l at the Edlin prompt to see the contents of the file.

1: Dear Mr. Muster:
2:
3: Congratulations on your promotion
4: to the position of Senior Chemical
5: Engineer. I continue to be most
6: impressed with your hard work.
7:
8: I think you will enjoy working with
9: Mr. Lang on the new project. Please
10: let me know if there is anything I
11: can do to assist you.
12:
13: Sincerely,
14:
15: S.L. Martin, President
16: Rockdale Corporation
17: "A World Leader in Technology"

Now suppose that in lines 5 through 10 you want Edlin to replace all occurrences of the word "I" with the words "yours truly". Type the first part of the command as follows, but do not press ENTER:

5,10rI

To complete the command, press CTRL+Z (which appears on the screen as ^Z), type the words yours truly, and press ENTER. The complete command appears on the screen as follows:

5,10rI^Zyours truly

Because the ? parameter is omitted, Edlin replaces the three occurrences of "I" without prompting you by displaying the confirmation message. When Edlin finishes carrying out the command, it displays the following lines, which are changed as a result of the three replacements:

5: Engineer. yours truly continue to be most
8: yours truly think you will enjoy working with
10: let me know if there is anything yours truly

In the previous example, two unintended replacements occurred--in lines 5 and 8. You can avoid such changes by adding the ? parameter to the command. The completed command should appear on screen as follows:

5,10?rI^Zyours truly

Now, Edlin prompts you by displaying the confirmation message for each occurrence of the string specified in string1 and carries out only confirmed replacements, as the following example shows:

5: Engineer. yours truly continue to be most
O.K.? n
8: yours truly think you will enjoy working with
O.K.? n
10: let me know if there is anything yours truly
O.K.? y

When the ? parameter is used, Edlin does not automatically display the lines that are changed as a result of the confirmed replacements. If you type the Edlin l (list) command at the Edlin prompt, Edlin displays the edited file that is in memory, as follows:

1: Dear Mr. Muster:
2:
3: Congratulations on your promotion
4: to the position of Senior Chemical
5: Engineer. I continue to be most
6: impressed with your hard work.
7:
8: I think you will enjoy working with
9: Mr. Lang on the new project. Please
10: let me know if there is anything yours truly
11: can do to assist you.
12:
13: Sincerely,
14:
15: S.L. Martin, President
16: Rockdale Corporation
17: "A World Leader in Technology"

More Information About Edlin: R

ntcmds00000001.gif Edlin: R--Notes

ntcmds00000001.gif Edlin: R

Cotse.Net

Protect yourself from cyberstalkers, identity thieves, and those who would snoop on you.
Stop spam from invading your inbox without losing the mail you want. We give you more control over your e-mail than any other service.
Block popups, ads, and malicious scripts while you surf the net through our anonymous proxies.
Participate in Usenet, host your web files, easily send anonymous messages, and more, much more.
All private, all encrypted, all secure, all in an easy to use service, and all for only $5.95 a month!

Service Details

 
.
www.cotse.com
Have you gone to church today?
.
All pages ©1999, 2000, 2001, 2002, 2003 Church of the Swimming Elephant unless otherwise stated
Church of the Swimming Elephant©1999, 2000, 2001, 2002, 2003 Cotse.com.
Cotse.com is a wholly owned subsidiary of Packetderm, LLC.

Packetderm, LLC
210 Park Ave #308
Worcester, MA 01609