[NTLUG:Discuss] Perl help

Eric Waguespack ewaguespack at gmail.com
Tue Feb 5 16:33:47 CST 2008


perl -e 'for $n ( 31000 .. 31500 ) { if ( ! -e "$n.wav" ) { print
"$n.wav\n"; exit }}; done'

./e

On Feb 5, 2008 4:10 PM, Michael Barnes <barnmichael at gmail.com> wrote:
> I'm looking for a quick perl script and my brain just isn't
> functioning right now.
>
> I have a folder full of audio files.  Each file is a five digit
> number.wav, i.e. 12345.wav.
>
> Files are entered in this folder into particular groups of numbers, so
> there are lots of gaps.
>
> I need to search a range of these files from 31000.wav to 31500.wav
> (ignoring everything below 31000 and above 31500) and find the largest
> available file number to use.  There may be files 31000.wav-31057.wav
> in use,  (There would be no files 31058-31500) making 31058 the next
> available file.
>
> All I need to do is get the next number (31058 in this case) into a
> variable to be used elsewhere.
>
> I know this should be quite easy, but I sure can't get my head around
> it right now.
>
> Thanks for any help you can come up with.
>
> Michael
>
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
>



More information about the Discuss mailing list