unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Help needed with substitute* command
@ 2022-01-06 12:53 Mortimer Cladwell
  2022-01-06 13:50 ` Tobias Geerinckx-Rice
  0 siblings, 1 reply; 3+ messages in thread
From: Mortimer Cladwell @ 2022-01-06 12:53 UTC (permalink / raw)
  To: help-guix

Hi,
I do not understand the second substitute* example in the Guix Manual.
I have the executable mysubs.scm:

--mysubs.scm---------------------------------------------------------
(add-to-load-path
"/gnu/store/rjzj1z89jqcb60nhg5gknkibcl84b3jb-guix-29745d23b-modules/share/guile/site/3.0")
(add-to-load-path ".")

(use-modules
    (guix build utils)
    (ice-9 rdelim)
    (ice-9 popen)
    (ice-9 regex) ;;list-matches
    (ice-9 pretty-print))

(define (main args)
  (begin
    (substitute* "./input.txt"
(("hello")
 "good morning\n")
(("foo([a-z]+)bar(.*)$" all letters end)
 (string-append "baz" letters end))))
  (pretty-print "done"))

  ---------end------------------------------------------------------------

  I run this on 2 different inputs representing the two examples in the
manual:


  ---input.txt(1)------
  hello

  ---------------------

  result: good morning


  ---input.txt(2)-------
  foo(abc)bar(def)

  -------------------

  result:  foo(abc)bar(def)

  Why no substitution with the second example?
  Is the letters/letter in the manual a typo?  If I use letter I get
"...unbound variable..."

  Thanks
  Mortimer

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-06 14:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06 12:53 Help needed with substitute* command Mortimer Cladwell
2022-01-06 13:50 ` Tobias Geerinckx-Rice
2022-01-06 14:53   ` Mortimer Cladwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).