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
