Date: Sun, 23 May 2010 22:40:41 +0200 From: Jozsi Vadkan <jozsi.avadkan@gmail.com> To: FreeBSD Mailing list <freebsd-questions@freebsd.org> Subject: Re: tricky perl question - ascending order Message-ID: <1274647241.6474.51.camel@localhost> In-Reply-To: <864ohyfqch.fsf@red.stonehenge.com> References: <1274631361.6474.28.camel@localhost> <864ohyfqch.fsf@red.stonehenge.com>
next in thread | previous in thread | raw e-mail | index | archive | help
The solution [i asked Randal L. Schwartz, because i didn't worked, and
he said he just forgot the "-e", now it works!!]:
perl -00 -e 'print map $_->[0], sort { $a->[1] <=> $b->[1] } map [$_,
tr/\n//], <>' < before.txt > after.txt
Thank you!!
> >>>>> "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.
>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1274647241.6474.51.camel>
