Re: string formating
From: Franco Fellico' (ffellico_at_inwind.it)
Date: 08/29/04
- Next message: Kenny McCormack: "(patch for bash) Turbo Tax tax preparation module"
- Previous message: Brian Inglis: "Re: awk question"
- In reply to: Chris F.A. Johnson: "Re: string formating"
- Next in thread: Stephane CHAZELAS: "Re: string formating"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Aug 2004 00:16:34 -0700
"Chris F.A. Johnson" <cfajohnson@gmail.com> wrote in message news:<2pbkcuFj6ingU1@uni-berlin.de>...
> On 2004-08-28, Franco Fellico' wrote:
> > Hi.
> >
> > I am referring to a bash script.
> >
> > I would like to create in a loop a string variable containing in turn
> > 001, 002, 003... 00n
> >
> > So, suppose to have a counter wich in the loop contain the numbers 1,
> > 2, 3, n, how I can convert each number in a string of the form 001,
> > 002, 003, 00n?
>
> If you have the seq command:
>
> n=99
> for num in $(printf "%03d" `seq -w $n`)
> do
> : ....
> done
>
> If you have bash version 3:
>
> for num in `printf "%03d" {1..99}`
> do
> : ....
> done
>
> If you have William Park's patched bash (patch available at
> <http://home.eol.ca/~parkw/index.html#bash>):
>
> for num in {001..099}
> do
> : .....
> done
--------
Thank you for help. I solved my problem! Franco
- Next message: Kenny McCormack: "(patch for bash) Turbo Tax tax preparation module"
- Previous message: Brian Inglis: "Re: awk question"
- In reply to: Chris F.A. Johnson: "Re: string formating"
- Next in thread: Stephane CHAZELAS: "Re: string formating"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|