tricky perl question - ascending order
or maybe in bash.. script/one liner e.g.: input: http://pastebin.com/raw.php?i=pMZPEsMZ i want to make this output from it: http://pastebin.com/raw.php?i=kH8VxT0A So from the input, i want to make an ascendant order, how many things are under a SOMETHING-XX Does anyone has any perl magic in the pocket, how to do this? :D Thank you very, very much..:\ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: tricky perl question - ascending order
Jozsi == Jozsi Vadkan jozsi.avad...@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 mer...@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 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: tricky perl question - ascending order
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.avad...@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. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org