I have a texinfo file containing book records and I want to sort them. An example is shown below.
Records are separated by two blank lines. The sort pattern I want to sort is starting from the beginning of the year declaration and finishing at the beginning of the book title where I use the command @strong
.
The resulting file would look the same as the original, but the records will be sorted.
@sp 1
@anchor{bibl--Borcherdt--1982}
1982.@: @sc{Borcherdt, Roger D.}; @strong{Reflection-refraction of
general P- and Type-I S-waves in elastic and anelastic solids.}
Geophysical Journal of the Royal Astronomical Society, Volume 70, Pages
621-638.
@uref{academic.oup.com/gji/article/70/3/621/623392,,
[@sc{Complete Article}]} [@code{bibl--Borcherdt--1982}].
@c Published: September 01, 1982.
@sp 1
@anchor{bibl--Kennett--2007}
2007.@: @sc{Kennett, Brian}; @strong{Seismic phases.} In: Gubbins,
David; Herrero-Bervera, Emilio (Eds.); "Encyclopedia of Geomagnetism and
Paleomagnetism."
@uref{link.springer.com/referenceworkentry/10.1007/978-1-4020-4423-6_290,,
[@sc{Doi}]} [@code{bibl--Kennett--2007}].
@c Published:
@sp 1
@anchor{bibl--Bormann--et--Storchak--et--Schweitzer--2013}
2013.@: @sc{Bormann, Peter}; Storchak, Dmitry A.; Schweitzer, Johannes;
@strong{The IASPEI standard nomenclature of seismic phases.} In:
Bormann, P.@: (Ed.), "New Manual of Seismological Observatory Practice 2
(NMSOP-2)".
@uref{gfzpublic.gfz-potsdam.de/pubman/faces/viewItemOverviewPage.jsp?itemId=escidoc:152435:3#files,,
[@sc{Complete Article}]} [@code{bibl--Bormann--2013}].
@c Published: September 01, 2013.
Have tried using awk with a space for RS to distinguish each paragraph. However
the result is all messed up.
awk -v RS="" -v cmd=sort '{print | cmd; close(cmd); print ""}' Ch02c--Rfc.texi
1959.@: @sc{Brune, J.N.}; Oliver, J.; @strong{The seismic noise of the
@anchor{bibl--Brune--et--Oliver--1959}
@c Published: October 01, 1959.
Earth's surface.} Bulletin of the Seismological Society of America,
[@sc{Doi}]} [@code{bibl--Brune--et--Oliver--1959}].
@sp 1
@uref{pubs.geoscienceworld.org/ssa/bssa/article-abstract/49/4/349/115922/the-seismic-noise-of-the-earth-s-surface,,
Volume 49, Pages 349-353.
1959.@: @sc{Knopoff, Leon}, @strong{Scattering of compression waves by
@anchor{bibl--Knopoff--1959}
@c Published 1959.
[@sc{Doi}]} [@code{bibl--Knopoff--1959}].
@sp 1
spherical obstacles.} Geophysics, Volume 24, Pages 30-39.
@uref{pubs.geoscienceworld.org/geophysics/article-abstract/24/1/30/67439/scattering-of-compression-waves-by-spherical,,
1950.@: @strong{Longuet-Higgins, Michael Selwyn}; @strong{A Theory of
243, No.@: 857, Pagination 1-35.
@anchor{bibl--Longuet--Higgins--1950}
@c Published: September 27, 1950.
[@sc{Complete Article}]} [@code{bibl--Longuet--Higgins--1950}].
Society of London, Series A, Mathematical and Physical Sciences, Volume
@sp 1
the Origin of Microseisms.} Philosophical Transactions of the Royal
@uref{epsc.wustl.edu/~ggeuler/reading/cam_noise_biblio/longuet-higgins_1950-ptrsl-a_theory_of_the_origin_of_microseisms.pdf,,