[PLUG] Sorting blocks of text

John Jason Jordan johnxj at comcast.net
Wed Nov 23 02:50:24 UTC 2016


On Tue, 22 Nov 2016 16:45:05 -0800 (PST)
Rich Shepard <rshepard at appl-ecosys.com> 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.
>
>Is there an emacs function that will do this? My knowledge of awk
>suggests that it's not the appropriate tool. There surely is some
>linux tool do do this job, yes?
>
>I don't know perl, but could write a python script to do this.

Could you convert the text to a database delimited by two line feeds?
Once in database format you can sort any way you want using any number
of database utilities.



More information about the PLUG mailing list