[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug#6554: [PATCH] split: Additional suffix for split (bug#6554)
From: |
Pádraig Brady |
Subject: |
Re: bug#6554: [PATCH] split: Additional suffix for split (bug#6554) |
Date: |
Sat, 28 Jan 2012 14:48:54 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 |
On 01/27/2012 05:28 PM, Jérémy Compostella wrote:
> Eric, Peng, others,
>
>> On 06/15/2010 09:23 PM, Peng Yu wrote:
>>> I need to add an additional common suffix to the files splited by
>>> split. Right now, I have to use mv to do so. But I feel it is
>>> convenient to have an option to add the suffix. Is this feature going
>>> to be considered to be added in the future?
>>
>> Hmm, considering that we recently taught mktemp how to honor suffixes,
>> it does indeed sound like this might be a useful feature addition. It's
>> probably not going to be my highest priority to write such a patch, but
>> I'll gladly review any patch written by someone else.
>
> I'm interested in this feature too so I wrote the attached patch which
> implements it by adding the "--suffix=SUFF" option.
>
> As this is my first contribution to this project, I'm not conformable
> with coreutils coding standard or documentation needs, so feel free to
> comment the submitted patch. I will take into account whatever you ask
> for.
>
> Cheers,
>
> Jérémy
> ---
Thanks a lot for working on this.
Could you give a real world example where
you find this useful, just for the record.
I should note that --suffix is incompatible
with a variable length generated suffix.
I.E. one that would allow for arbitrary sized input:
http://lists.gnu.org/archive/html/bug-coreutils/2009-09/msg00220.html
Though I guess that functionality could still be
provided if required, by specifying --suffix-length=auto
and having that mutually exclusive with --suffix.
As for the patch, it seems to work :)
t$ seq 10 > file.txt
t$ ../split -n10 --suffix=.txt file.txt file.
t$ l
-rw-rw-r--. 1 padraig 21 Jan 28 14:06 file.txt
-rw-rw-r--. 1 padraig 3 Jan 28 14:06 file.aj.txt
-rw-rw-r--. 1 padraig 2 Jan 28 14:06 file.ai.txt
-rw-rw-r--. 1 padraig 2 Jan 28 14:06 file.ah.txt
-rw-rw-r--. 1 padraig 2 Jan 28 14:06 file.ag.txt
-rw-rw-r--. 1 padraig 2 Jan 28 14:06 file.af.txt
-rw-rw-r--. 1 padraig 2 Jan 28 14:06 file.ae.txt
-rw-rw-r--. 1 padraig 2 Jan 28 14:06 file.ad.txt
-rw-rw-r--. 1 padraig 2 Jan 28 14:06 file.ac.txt
-rw-rw-r--. 1 padraig 2 Jan 28 14:06 file.ab.txt
-rw-rw-r--. 1 padraig 2 Jan 28 14:06 file.aa.txt
We'd need some corresponding documentation in doc/coreutils.texi,
and an entry in NEWS.
Also even thought the patch is small, you'd need to start
the copyright assignment process for a new parameter to `split`.
cheers,
Pádraig.