|
Lines 584-617
Link Here
|
| 584 |
The colon may be escaped with a backslash |
584 |
The colon may be escaped with a backslash |
| 585 |
.Pq Ql \e . |
585 |
.Pq Ql \e . |
| 586 |
.Bl -tag -width Cm |
586 |
.Bl -tag -width Cm |
| 587 |
.Sm off |
|
|
| 588 |
.It Cm C No \&/ Ar pattern Xo |
| 589 |
.No \&/ Ar replacement |
| 590 |
.No \&/ Op Cm 1g |
| 591 |
.Xc |
| 592 |
.Sm on |
| 593 |
The |
| 594 |
.Cm C |
| 595 |
modifier is just like the |
| 596 |
.Cm S |
| 597 |
modifier except that the old and new strings, instead of being |
| 598 |
simple strings, are a regular expression (see |
| 599 |
.Xr regex 3 ) |
| 600 |
and an |
| 601 |
.Xr ed 1 Ns \-style |
| 602 |
replacement string. Normally, the first occurrence of the pattern in |
| 603 |
each word of the value is changed. The |
| 604 |
.Ql 1 |
| 605 |
modifier causes the substitution to apply to at most one word; the |
| 606 |
.Ql g |
| 607 |
modifier causes the substitution to apply to as many instances of the |
| 608 |
search pattern as occur in the word or words it is found in. Note that |
| 609 |
.Ql 1 |
| 610 |
and |
| 611 |
.Ql g |
| 612 |
are orthogonal; the former specifies whether multiple words are |
| 613 |
potentially affected, the latter whether multiple substitutions can |
| 614 |
potentially occur within each affected word. |
| 615 |
.It Cm E |
587 |
.It Cm E |
| 616 |
Replaces each word in the variable with its suffix. |
588 |
Replaces each word in the variable with its suffix. |
| 617 |
.It Cm H |
589 |
.It Cm H |
|
Lines 685-690
Link Here
|
| 685 |
of a dollar sign |
657 |
of a dollar sign |
| 686 |
.Pq Ql \&$ , |
658 |
.Pq Ql \&$ , |
| 687 |
not a preceding dollar sign as is usual. |
659 |
not a preceding dollar sign as is usual. |
|
|
660 |
.Sm off |
| 661 |
.It Cm C No \&/ Ar pattern Xo |
| 662 |
.No \&/ Ar replacement |
| 663 |
.No \&/ Op Cm 1g |
| 664 |
.Xc |
| 665 |
.Sm on |
| 666 |
The |
| 667 |
.Cm C |
| 668 |
modifier is just like the |
| 669 |
.Cm S |
| 670 |
modifier except that the old and new strings, instead of being |
| 671 |
simple strings, are a regular expression (see |
| 672 |
.Xr regex 3 ) |
| 673 |
and an |
| 674 |
.Xr ed 1 Ns \-style |
| 675 |
replacement string. Normally, the first occurrence of the pattern in |
| 676 |
each word of the value is changed. The |
| 677 |
.Ql 1 |
| 678 |
modifier causes the substitution to apply to at most one word; the |
| 679 |
.Ql g |
| 680 |
modifier causes the substitution to apply to as many instances of the |
| 681 |
search pattern as occur in the word or words it is found in. Note that |
| 682 |
.Ql 1 |
| 683 |
and |
| 684 |
.Ql g |
| 685 |
are orthogonal; the former specifies whether multiple words are |
| 686 |
potentially affected, the latter whether multiple substitutions can |
| 687 |
potentially occur within each affected word. |
| 688 |
.It Cm T |
688 |
.It Cm T |
| 689 |
Replaces each word in the variable with its last component. |
689 |
Replaces each word in the variable with its last component. |
| 690 |
.It Ar old_string=new_string |
690 |
.It Ar old_string=new_string |