tricky perl question - ascending order

Randal L. Schwartz merlyn at stonehenge.com
Sun May 23 18:03:11 UTC 2010


>>>>> "Jozsi" == Jozsi Vadkan <jozsi.avadkan at gmail.com> writes:

Jozsi> So from the input, i want to make an ascendant order, how many things
Jozsi> are under a "SOMETHING-XX"

So you just want paragraphs ordered by line count?

Something like this, untested:

perl -00 'print map $_->[0], sort { $a->[1] <=> $b->[1] } map [$_, tr/\n//], <>' <input >output

Keywords: Schwartzian Transform, paragraph mode.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


More information about the freebsd-questions mailing list