sed: Support command lists.
This commit is contained in:
parent
1302c8bf28
commit
5be7ed331d
|
@ -107,6 +107,8 @@
|
||||||
|
|
||||||
(define (execute-function function str)
|
(define (execute-function function str)
|
||||||
(match function
|
(match function
|
||||||
|
(('begin . commands)
|
||||||
|
(execute-commands commands str))
|
||||||
(('s pattern replacement flags)
|
(('s pattern replacement flags)
|
||||||
(substitute str pattern replacement flags))
|
(substitute str pattern replacement flags))
|
||||||
(_ (error "SED: unsupported function" function))))
|
(_ (error "SED: unsupported function" function))))
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
input='foo
|
||||||
|
bar'
|
||||||
|
|
||||||
|
echo "$input" | \sed '/foo/ { s/foo/baz/ s/baz/bar/ } s/bar/baz/'
|
|
@ -0,0 +1,2 @@
|
||||||
|
baz
|
||||||
|
baz
|
Loading…
Reference in New Issue