Not sure if I understand your input format well enough, but I think awk can
handle it, something like:
awk 'BEGIN{RS="\n\n"} { v[$0]++ } END { n = asorti(v,copy);
for(i=1;i<=n;i++){ print copy[i] } }'
On Tue, Nov 22, 2016 at 7:44 PM, David Fleck <[email protected]> wrote:
> On Tue, 2016-11-22 at 18:50 -0800, John Jason Jordan wrote:
> > On Tue, 22 Nov 2016 16:45:05 -0800 (PST)
> > Rich Shepard <[email protected]> dijo:
> >
> > >I've a few files of names and addresses; each block is separated by two
> > >blank lines. I'd like to sort them alphabetically by the first line.
> > >'sort' does not seem to do this as I don't see a record separator,
> > >only a field separator.
>
> Rich-
> this may be of no help to you at all, but the following string does what
> you ask on a short unsorted text file of addresses on my machine:
>
> cat filename | sed 's/^$/x/' | tr '\n' '+' | tr 'x' '\n' | sed '/^+$/d'
> | sort | tr '+' '\n'
>
> No guarantees of any kind, etc.
>
>
> --
> David Fleck <[email protected]>
>
> _______________________________________________
> PLUG mailing list
> [email protected]
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug