in reply to Re^3: one-line split file sequence checker
in thread one-line split file sequence checker
If you're just golfing, you can throw away a few characters:
perl -e 'for$c(sort{$a<=>$b}map/(\d+)$/,<*[0-9]>){++$n==$c||print map" +$_\n",$n..$c-1;$n=$c}'
If you want to get rid of the sort, try an array:
perl -le '@f=map/(\d+)$/,<*[0-9]>;@x[@f]=@f;for(1..$#x){$x[$_]||print} +'
Note that if you have a file named '0', it will basically ignore it, but that was the original behavior too. This may eat more memory, but I doubt that will be an issue until you're working with millions of files.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: one-line split file sequence checker
by jwkrahn (Abbot) on Jan 23, 2008 at 00:07 UTC | |
by wdef2 (Acolyte) on Jan 23, 2008 at 13:46 UTC |