🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #7064

Re: Preguntilla de sed - Así lo he hecho

#7064
From: J.A. Gutierrez
Date: Thu, 03 Apr 2003 09:05
30 lines
2161 bytes
sio2 <sio2.arr@ba.online.fr> wrote:
: El lunes, 31 de marzo de 2003, a las 10:42 GMT, sio2 escribi�:
:> [...] 
:> Lo que quiero es crearme un peque�o script (que use sed) , de manera
:> que el script admita como par�metro un n�mero que indica el texto que
:> quiero rescatar. Por ejemplo:
:> [...] 

: No s� si ser� lo mejor, pero por lo menos es bastante corto:

: ######
: #!/bin/sh

: parte=$(expr "$1" + 2)

: awk -v RS='%' "NR==$parte"
: ######

	te puedes ahorrar un subshell y un expr:

#!/bin/sh
exec awk -v RS='%' "NR==(p+2)" p=$1



-- 
finger spd@shiva.cps.unizar.es for PGP      /
.mailcap tip of the day:                   /             La vida es una carcel
application/ms-tnef; cat '%s' > /dev/null /           con las puertas abiertas
text/x-vcard; cat '%s' > /dev/null       /            (A. Calamaro)
Technical Details
Message-ID: <b6gth8$in7$1@localhost.escomposlinux.org>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!nntp-relay.ihug.net!ihug.co.nz!west.cox.net!cox.net!newsfeeder.mylinuxisp.com!213.98.107.123.MISMATCH!antonio.escomposlinux.org!marmolejo.escomposlinux.org!not-for-mail
References: <1b5b7a1f.0303310242.b117c5@posting.google.com> <slrnb8mn0q.bm4.sio2.arr@cebolleta.net.dhis.org>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,d868d3e9f4413baf
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2003-04-03 01:05:47 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!nntp-relay.ihug.net!ihug.co.nz!west.cox.net!cox.net!newsfeeder.mylinuxisp.com!213.98.107.123.MISMATCH!antonio.escomposlinux.org!marmolejo.escomposlinux.org!not-for-mail
From: "J.A. Gutierrez" <spd@daphne.cps.unizar.es>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Preguntilla de sed - Así lo he hecho
Date: Thu, 3 Apr 2003 09:05:44 +0000 (UTC)
Organization: Rank
Lines: 30
Sender: "J.A. Gutierrez" <spd@shiva.cps.unizar.es>
Message-ID: <b6gth8$in7$1@localhost.escomposlinux.org>
References: <1b5b7a1f.0303310242.b117c5@posting.google.com> <slrnb8mn0q.bm4.sio2.arr@cebolleta.net.dhis.org>
NNTP-Posting-Host: shiva.cps.unizar.es
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: localhost.escomposlinux.org 1049360744 19175 155.210.152.10 (3 Apr 2003 09:05:44 GMT)
X-Complaints-To: newsmaster@marmolejo.escomposlinux.org
NNTP-Posting-Date: Thu, 3 Apr 2003 09:05:44 +0000 (UTC)
User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (IRIX64/6.2 (IP19))