bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch] Add numerical suffixes to split


From: Bob Proulx
Subject: Re: [patch] Add numerical suffixes to split
Date: Wed, 25 Jun 2003 23:41:51 -0600
User-agent: Mutt/1.3.28i

Jesse Kornblum wrote:
> Hi there! I'm a computer crime investigator for the United States Air
> Force and have developed a patch to improve the functionality of
> 'split.'

Thanks for contributing your patch.  I can't speak to the suitability
of it's inclusion into the package.  But as a reader of the list I had
to comment upon the functionality.

> We use split to break large files generated by dd into smaller
> chunks. Unfortunately, our analysis programs want these chunks to have
> numerical suffixes (e.g. .001, .002, .003, etc) instead of the
> alphabetical ones that split currently generates. The patch below
> against split.c in Coreutils 5.0 adds numerical suffixes to split.

Not commenting upon the usefulness of having this functionality
natively in split.  But for me personally I would run the following
one-liner (although admittedly a long one-liner) to convert from the
lettered file names to your choice of numbered file names.  There are
a great many possibilities for creating file names.  You can't make
everyone happy.  But you can post process the result easily to create
specific names that meet your needs.

  c=1; for i in x*;do echo mv $i x.$(printf "%03d" $c); c=$(expr $c + 1);done

Obviously this would be formatted differently if it were included in a
script.  I just kept it compact for the mailing list.  Initialize the
counter, use printf to format into your prefered three columns with
leading zero (what do you do if you have more than 1000 files? ;-),
then increment the counter for the next iteration.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]