-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ed: implement global substitute (#786)
* The input g/search1/s/search2/replace/ allows search1 to filter the lines to process, then search2 determines the text to replace per line * Don't return in the condition for g & v commands; this allows the subsequent condition to determine the command to be run globally * Using rindex() to find delimiting '/' was incorrect because s/// confuses things with its own '/' * Adapt some code from getAddr() to find delimiter of search1 regex * test1: g/\//s/$/ NL/ ---> append the text " NL" to all lines matching literal '/' * test2: v/\//d ---> delete all lines not matching literal '/'
- Loading branch information
Showing
1 changed file
with
30 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters