erlug
[Top] [All Lists]

Re: [Erlug] manipolare testo da bash

To: erlug@xxxxxxxxxxxxxx
Subject: Re: [Erlug] manipolare testo da bash
From: Nando Santagata <nando@xxxxxxxxx>
Date: Tue, 28 Jun 2005 10:58:52 +0200
On Tue, Jun 28, 2005 at 10:45:52AM +0200, Nando Santagata wrote:
> On Tue, Jun 28, 2005 at 10:35:39AM +0200, Sythos wrote:
> > dovrei fare in modo che nella PENULTIMA riga venga inserita una parola
> > $PAROLA passata al volo, che strumenti posso rtfmare?
> 
> sh wc head tail
> 
> oppure
> 
> sed perl python ruby
> 
> oppure
> 
> gcc g++ asm nasm :-)

Ok, passo a [stronzo modo off] :-)

#!/bin/sh

righe=`wc -l filein|cut -f 1 -d ' '`
righe=$((righe-1))
head -$righe filein > fileout
echo $1 >> fileout
tail -1 filein >> fileout

Vediamo se e` questo cio` che vuoi/ti aspetti.

-- 
Rev. Nando Santagata: Telemastica & infornatica
You have reached Ritual Sacrifice. For goats, please press '1' or say 'goats'.
To sacrifice a loved one or pet, press the pound key.
Key fingerprint = 1054 9311 458D 4BAA E97B  F447 7CD4 54B5 0208 F815

<Prev in Thread] Current Thread [Next in Thread>