Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 May 2010 11:03:10 -0700
From:      merlyn@stonehenge.com (Randal L. Schwartz)
To:        Jozsi Vadkan <jozsi.avadkan@gmail.com>
Cc:        FreeBSD Mailing list <freebsd-questions@freebsd.org>
Subject:   Re: tricky perl question - ascending order
Message-ID:  <864ohyfqch.fsf@red.stonehenge.com>
In-Reply-To: <1274631361.6474.28.camel@localhost> (Jozsi Vadkan's message of "Sun, 23 May 2010 18:16:01 %2B0200")
References:  <1274631361.6474.28.camel@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> "Jozsi" == Jozsi Vadkan <jozsi.avadkan@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@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?864ohyfqch.fsf>