[ale] Generating sequential files with leading zeros from bash

Greg Freemyer greg.freemyer at gmail.com
Fri Apr 6 15:48:06 EDT 2007


Great,

I had no idea that you could call printf from the command line.

On 4/6/07, Michael B. Trausch <fd0man at gmail.com> wrote:
>
>  On Fri, 2007-04-06 at 15:37 -0400, Greg Freemyer wrote:
>
> I now how to manage the counter, but how can I create a filename with
> leading zeros from a bash script and a counter variable.
>
> ie. in C code I would do sprintf(dest_filename, "prefix-%07d.pgm",
> counter)
>
>
> Similarly:
>
> mbt at pepper:~$ echo $i
> 1
> mbt at pepper:~$ printf '%07d\n' $i
> 0000001
> mbt at pepper:~$
>
> The printf command comes from GNU coreutils, by the way.
>
>     -- Mike
>
> --
>   Michael B. Trausch  fd0man at gmail.com
>   Phone: (404) 592-5746   Jabber IM:  fd0man at gmail.com
> fd0man at livejournal.com
>   *Demand Freedom!  Use **open** and **free** protocols, standards, and
> software!*
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
>
>


-- 
Greg Freemyer
The Norcross Group
Forensics for the 21st Century
-------------- next part --------------
An HTML attachment was scrubbed...




More information about the Ale mailing list