From ilug-admin@linux.ie  Mon Aug 19 11:03:21 2002
Return-Path: <ilug-admin@linux.ie>
Delivered-To: yyyy@localhost.netnoteinc.com
Received: from localhost (localhost [127.0.0.1])
	by phobos.labs.netnoteinc.com (Postfix) with ESMTP id BC5CE441A0
	for <jm@localhost>; Mon, 19 Aug 2002 05:54:41 -0400 (EDT)
Received: from phobos [127.0.0.1]
	by localhost with IMAP (fetchmail-5.9.0)
	for jm@localhost (single-drop); Mon, 19 Aug 2002 10:54:41 +0100 (IST)
Received: from lugh.tuatha.org (root@lugh.tuatha.org [194.125.145.45]) by
    dogma.slashnull.org (8.11.6/8.11.6) with ESMTP id g7J9sm617403 for
    <jm-ilug@jmason.org>; Mon, 19 Aug 2002 10:54:48 +0100
Received: from lugh (root@localhost [127.0.0.1]) by lugh.tuatha.org
    (8.9.3/8.9.3) with ESMTP id KAA30847; Mon, 19 Aug 2002 10:53:58 +0100
Received: from corvil.com. (k100-159.bas1.dbn.dublin.eircom.net
    [159.134.100.159]) by lugh.tuatha.org (8.9.3/8.9.3) with ESMTP id KAA30818
    for <ilug@linux.ie>; Mon, 19 Aug 2002 10:53:51 +0100
X-Authentication-Warning: lugh.tuatha.org: Host k100-159.bas1.dbn.dublin.eircom.net
    [159.134.100.159] claimed to be corvil.com.
Received: from corvil.com (pixelbeat.local.corvil.com [172.18.1.170]) by
    corvil.com. (8.12.5/8.12.5) with ESMTP id g7J9rfn4029295; Mon,
    19 Aug 2002 10:53:41 +0100 (IST) (envelope-from padraig.brady@corvil.com)
Message-Id: <3D60C014.1050903@corvil.com>
Date: Mon, 19 Aug 2002 10:53:24 +0100
From: Padraig Brady <padraig.brady@corvil.com>
Organization: Corvil Networks
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020408
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: kevin lyda <kevin+dated+1030182374.2b7538@ie.suberic.net>
Cc: ilug@linux.ie
Subject: Re: [ILUG] expanding a string multiple times
References: <3D5D27B9.9080009@corvil.com>
    <20020817122603.GA1805@bagend.makalumedia.com>
    <3D60BA1D.8040504@corvil.com> <20020819104610.A9650@ie.suberic.net>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit
Sender: ilug-admin@linux.ie
Errors-To: ilug-admin@linux.ie
X-Mailman-Version: 1.1
Precedence: bulk
List-Id: Irish Linux Users' Group <ilug.linux.ie>
X-Beenthere: ilug@linux.ie

kevin lyda wrote:
> On Mon, Aug 19, 2002 at 10:27:57AM +0100, Padraig Brady wrote:
> 
>>>On Fri, Aug 16, 2002 at 05:26:33PM +0100, Padraig Brady wrote:
>>>
>>>>How can I repeat a string an arbitrary number
>>>>of times in bash/sed/...
>>>>
>>>>I.E. I'm missing the repeat in the following:
>>>>
>>>>STRING="> "
>>>>NUMBER=3
>>>>PREFIX=repeat $STRING $NUMBER
>>>>echo $PREFIX
>>>
> 
> huh?  i missed all this.  do you want the string all on one line?
> 
> the string repeated over and over, but with linebreaks in between,
> this works:
> 
>     yes "$STRING" | head -"$NUMBER"
> 
> use sed to remove the newline i guess if you want.  the utilities yes,
> head and sed are on pretty much every unix.

Good. I actually looking at `yes` but I was in
slow mode on Friday and didn't consider combining with `head`

To remove newlines then handiest is: tr -d '\n'

thanks,
Pdraig.


-- 
Irish Linux Users' Group: ilug@linux.ie
http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
List maintainer: listmaster@linux.ie

