Identify missing parts in a sequence of split files in the current dir eg file.1, file.03, file.005 etc => prints 2 and 4
I'm sure this could be made tighter, I'm still a Perl newbie.
perl -e 'for $c (sort {$a<=>$b} grep(s/^.+?([0-9]+)$/$1/, `ls *[0-9]`)){ ++$n == $c || print grep(s/$/\n/, $n...$c-1) ; $n=$c }'
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: one-line split file sequence checker
by jwkrahn (Abbot) on Jan 22, 2008 at 21:09 UTC | |
by kyle (Abbot) on Jan 22, 2008 at 21:55 UTC | |
by wdef2 (Acolyte) on Jan 22, 2008 at 22:31 UTC | |
by kyle (Abbot) on Jan 22, 2008 at 23:08 UTC | |
by jwkrahn (Abbot) on Jan 23, 2008 at 00:07 UTC | |
| |
Re: one-line split file sequence checker
by poolpi (Hermit) on Jan 24, 2008 at 13:28 UTC | |
by wdef2 (Acolyte) on Jan 24, 2008 at 15:43 UTC | |
by kyle (Abbot) on Jan 24, 2008 at 16:48 UTC | |
Re: one-line split file sequence checker
by ambrus (Abbot) on Jan 25, 2008 at 09:26 UTC |
Back to
Cool Uses for Perl