Re: csplit - split by content of field (original) (raw)


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


From: Assaf Gordon
Subject: Re: csplit - split by content of field
Date: Thu, 07 Feb 2013 10:02:24 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4

Pádraig Brady wrote, On 02/06/2013 05:38 PM:

On 02/06/2013 10:09 PM, Assaf Gordon wrote: > > Attach is a patch that gives 'csplit' the ability to split files by content > of a field. > Yes such a feature is useful, though maybe in conjuntion with uniq: http://lists.gnu.org/archive/html/coreutils/2011-03/msg00000.html

So basically the proposal there is to support --suppress-matched so that you could then do:

uniq -w1 --unique=separated --all-repeated=separated | csplit --suppress-matched '/^$/' '{*}'

The caveat with that though is that uniq would benefit from better field selection, which is also on the TODO list.

uniq with fields is indeed useful, but the example above seems a bit long for something that can be acheived natively with just csplit (IMHO) - what do you think ?

-gordon