From owner-freebsd-questions@FreeBSD.ORG Sun May 23 20:40:45 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6764B1065674 for ; Sun, 23 May 2010 20:40:45 +0000 (UTC) (envelope-from jozsi.avadkan@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id EAABB8FC1A for ; Sun, 23 May 2010 20:40:44 +0000 (UTC) Received: by fxm4 with SMTP id 4so2744399fxm.13 for ; Sun, 23 May 2010 13:40:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:in-reply-to :references:content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=uVfr28Z62dUYfG1cAD59oUrJ7PdUSRx45niCNPN0awo=; b=On/56xLOdjcSG4BdN/YlkcH5CjUwO4KBWfmMEfuEtQefdRzyOvZLSczyICGZZh854S qE+2lO4JLhSvcdLUquG9beahhpD1Hx78C85NQtNdl84NoCQGq7t57KGkTr5as/ujlKy4 WRq0z8UGOoGVT3vztCnE9gfxD9Oe8zR3hmgko= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:in-reply-to:references:content-type:date:message-id :mime-version:x-mailer:content-transfer-encoding; b=R5ooxYGe0K6fHdjTy3NkyB3gQ16M7BqiERwWBwqXUF+T8pWUn4q0N5m2b3BM3xEWMs zCqshdkRikMJME1G9J5j17myrKAZr12y1uBQO6LG2d20vgDSgNMopzr1NGVUk/u4gAJE +oZZFiWcQkPD3jYicjPGFDfu2GAR5AAphK5Sw= Received: by 10.223.98.19 with SMTP id o19mr3928902fan.80.1274647243944; Sun, 23 May 2010 13:40:43 -0700 (PDT) Received: from [94.44.8.163] (apn-94-44-8-163.vodafone.hu [94.44.8.163]) by mx.google.com with ESMTPS id 15sm16046482fad.22.2010.05.23.13.40.42 (version=SSLv3 cipher=RC4-MD5); Sun, 23 May 2010 13:40:43 -0700 (PDT) From: Jozsi Vadkan To: FreeBSD Mailing list In-Reply-To: <864ohyfqch.fsf@red.stonehenge.com> References: <1274631361.6474.28.camel@localhost> <864ohyfqch.fsf@red.stonehenge.com> Content-Type: text/plain Date: Sun, 23 May 2010 22:40:41 +0200 Message-Id: <1274647241.6474.51.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit Subject: Re: tricky perl question - ascending order X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2010 20:40:45 -0000 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 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//], <>' output > > Keywords: Schwartzian Transform, paragraph mode. >