[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFE: head,tail: -z, --zero-terminated
From: |
Pádraig Brady |
Subject: |
Re: RFE: head,tail: -z, --zero-terminated |
Date: |
Tue, 12 Jan 2016 16:41:00 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 08/01/16 22:07, Pádraig Brady wrote:
> On 08/01/16 19:04, Assaf Gordon wrote:
>> an open question:
>> With -z, do embedded newlines count as whitespace/field delimiters ?
>> (not sure if this applies to other programs).
>>
>> For example:
>>
>> $ printf "A B\tC\nD 1000\x00"
>>
>> Should the newline count as whitespace/field delimiter (since numfmt
>> defaults to whitespace delimiters) ?
>> If so, the "1000" should be the fifth field.
>> If not, the "1000" should be in the fourth field (and "C\nD" cound as one
>> field).
>>
>> Currently, because the numfmt code uses "isblank()", newlines DO NOT count
>> as whitespace:
>>
>> $ printf "A B\tC\nD 1000\x00" | ./src/numfmt -z --to=si --field=4 | od
>> -a
>> 0000000 A sp B sp C nl D sp 1 . 0 K nul
>> 0000015
>
> A very good point.
> This is not an issue for the utils in my current patch set I think,
> but is for field processing utils like numfmt, sort, join, uniq
> (cut delimits fields with a char rather than a class).
> I.E. should these utils use isspace() rather than isblank()
> when -z is specified? More conservatively they probably
> should use isblank(c) || c=='\n'.
Attached patch implements this for join, sort, uniq.
thanks,
Pádraig.
newline-fields.patch
Description: Text Data
- Re: RFE: head,tail: -z, --zero-terminated, Pádraig Brady, 2016/01/08
- Re: RFE: head,tail: -z, --zero-terminated, Assaf Gordon, 2016/01/08
- Re: RFE: head,tail: -z, --zero-terminated, Assaf Gordon, 2016/01/08
- Re: RFE: head,tail: -z, --zero-terminated, Pádraig Brady, 2016/01/08
- Re: RFE: head,tail: -z, --zero-terminated,
Pádraig Brady <=