From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Decebal Newsgroups: gmane.emacs.help Subject: Re: How to [write sequentially numbered lines] Date: Sat, 10 Oct 2009 14:20:26 -0700 (PDT) Organization: http://groups.google.com Message-ID: <664b7f18-c3e3-41a3-af53-de58a83ed776@z24g2000yqb.googlegroups.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1255210976 32077 80.91.229.12 (10 Oct 2009 21:42:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 10 Oct 2009 21:42:56 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Oct 10 23:42:46 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mwji9-0004aK-9L for geh-help-gnu-emacs@m.gmane.org; Sat, 10 Oct 2009 23:42:45 +0200 Original-Received: from localhost ([127.0.0.1]:56193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mwji8-0006w7-Qw for geh-help-gnu-emacs@m.gmane.org; Sat, 10 Oct 2009 17:42:44 -0400 Original-Path: news.stanford.edu!usenet.stanford.edu!postnews.google.com!z24g2000yqb.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 20 Original-NNTP-Posting-Host: 84.53.123.169 Original-X-Trace: posting.google.com 1255209627 21113 127.0.0.1 (10 Oct 2009 21:20:27 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 10 Oct 2009 21:20:27 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z24g2000yqb.googlegroups.com; posting-host=84.53.123.169; posting-account=K-cdeAoAAAD_0d505kUtHXJaT5LFIu-3 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; nl; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:173730 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:68820 Archived-At: On Oct 10, 10:55=A0pm, Vassil Nikolov wrote: > > =A0 =A0 =A0 local i > > =A0 =A0 =A0 local length=3D${#1} > > =A0 =A0 =A0 for i in $(seq ${1}) ; do > > =A0 =A0 =A0 =A0 printf " =A0 =A0 =A0 Regel %${length}d voor de test\n" = ${i} > > =A0 =A0 =A0 done =A0>${2} > > =A0 translates to > > =A0 =A0 emacs -Q -batch -eval ' > =A0 =A0 =A0 (dotimes (i '"${1}"') > =A0 =A0 =A0 =A0 (princ (format " =A0 =A0 =A0 Regel %'"${#1}"'d voor de te= st\n" (1+ i)))) > =A0 =A0 ' > "${2}" That works like a charm. Now it takes 19 seconds. More as 3 times as fast as my version and more as 15 times as fast as the Bash version. Thanks.