[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grep and sed in guile
From: |
Ludovic Courtès |
Subject: |
Re: grep and sed in guile |
Date: |
Tue, 27 Aug 2013 15:27:51 +0200 |
User-agent: |
Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) |
> 3) (sed m expr)
>
> This will print out on std output all lines not matched by m, if m is
> matched then that expr will make sure to print the correct way
>
> An example matcher is
> m := (s-tr a b)
>
> which will replace a by b
FWIW Guix has a sed-like macro, called ‘substitute*’ [0]. Example:
(substitute* "my-file.txt"
(("^(.*) world$" _ first-word)
(string-append "Hello (was: " first-word ") world\n")))
Ludo’.
[0] http://git.savannah.gnu.org/cgit/guix.git/tree/guix/build/utils.scm#n387