Hi all, Ian Bearden <bearden@nbi.dk> wrote concerning Re: [Brahms-dev-l] 10K problem [Thu, 29 Jan 2004 17:59:03 +0100] ---------------------------------------------------------------------- > I have been looking through some of the calibrations scripts today, and > noticed this same thing... I'd suggest that you change lines like filename="${dir}/run00${runno}seq${seqno}.dat" to filename=`printf %s/run%06dseq%03.dat ${dir} ${runno} ${seqno}` (The shell command `printf' works like the C library function of the same name - surprise, surprise :-) In this way, you'll never have a problem like that (I don't suppose that BRAHMS will ever take more than 1e6 runs - if that is not true, increase the number of digits to 7 or 8). In ROOT scripts, you can use Form("%s/run%06dseq%03d.dat", dirOption.GetValue(), runnoOption.GetValue(), seqnoOption.GetValue()) or similar. Again, if more than 1e6 runs is expected, then increase the number of digits from 6 to 7 or 8. If you need to rename existing files, you can do a shell loop like bash> for i in run*seq*.dat ; do \ n=`echo $i | sed -e 's/run//' -e '/seq*//'` ; \ m=`echo $i | sed -e 's/*segn//'` ; \ o=`printf run%06dseq%03d.dat $n $m` ; \ mv $i $o ; done Notice that I'm assuming that you use a SH like shell e.g., BASH. If you're not, switch to a SH shell, by executing `/bin/sh' (most often a symlink to `/bin/bash'). > yuck, That's exactly why I say that Q'n'D most often means `Quirky and Defunct' (though often meant as a catch phrase for `Quick and Dirty'). I think I'll quote Ian on this: The 7 P's Proper prior preparation prevents piss-poor performance :-) Yours, ___ | Christian Holm Christensen |_| | ------------------------------------------------------------- | | Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91 _| DK-2200 Copenhagen N Cell: (+45) 24 61 85 91 _| Denmark Office: (+45) 353 25 404 ____| Email: cholm@nbi.dk Web: www.nbi.dk/~cholm | | _______________________________________________ Brahms-dev-l mailing list Brahms-dev-l@lists.bnl.gov http://lists.bnl.gov/mailman/listinfo/brahms-dev-lReceived on Fri Jan 30 05:53:29 2004
This archive was generated by hypermail 2.1.8 : Fri Jan 30 2004 - 05:53:47 EST