all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to
@ 2009-10-10 18:33 Decebal
  2009-10-10 20:06 ` Andreas Röhler
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Decebal @ 2009-10-10 18:33 UTC (permalink / raw)
  To: help-gnu-emacs

In a Bash script I changed:
      local i
      local length=${#1}

      for i in $(seq ${1}) ; do
        printf "       Regel %${length}d voor de test\n" ${i}
      done  >${2}
to:
      emacs -batch -nw --eval='
        (let (
              (i)
              (nr-of-lines '${1}')
              (nr-of-lines-length)
              (output-file "'"${2}"'"))
          (setq nr-of-lines-length (length (number-to-string nr-of-
lines)))
          (dotimes (i nr-of-lines t)
           (insert (format (format "       Regel %%%dd voor de test\n"
nr-of-lines-length) (1+ i))))
          (write-file output-file))
      ' 2>/dev/null

The Bash version took 293 seconds and the Emacs Lisp version 59
seconds. So it is about 5 times as fast.
The Emacs batch gives output like:
    Saving file /home/cecil/temp/inputEmacs...
    Wrote /home/cecil/temp/inputEmacs
That is why I use the 2>/dev/null.
Is there a way to circumvent the generation of the above output?
Because when there is an error it is also thrown away and that is not
nice.


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

end of thread, other threads:[~2009-10-11 16:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-10 18:33 How to Decebal
2009-10-10 20:06 ` Andreas Röhler
2009-10-10 20:55 ` How to [write sequentially numbered lines] Vassil Nikolov
2009-10-10 21:20   ` Decebal
     [not found] ` <mailman.8511.1255205222.2239.help-gnu-emacs@gnu.org>
2009-10-10 20:57   ` How to Decebal
2009-10-11  1:41     ` Decebal
2009-10-11  8:11       ` Andreas Röhler
     [not found]       ` <mailman.8527.1255248737.2239.help-gnu-emacs@gnu.org>
2009-10-11 16:20         ` Decebal

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.