programming in bash Shell

Michalis Kabrianis kabrianis at hellug.gr
Thu Mar 9 16:04:42 EET 2000


On 10-Mar-2000 Olga +Natalia wrote:
<snip>
 
> Ftiaxnw enan pinaka pliroforiwn  to opoio exei 3 pedia
>    ID, First-name , Last-name,   pou einai ta $1, $2, $3 antistoixa
> 
> Paradeigma-1 :
> exw to arxeio "step-ena" to opoio apoteleitai apo 8 grammes :
> 
> $cat  step-ena
> 1    Olga      Makri
> 2    Natalia  Kontou
> 3    Maria    Kamprianou
                ^^^^^^^^^^
Syggenis mou i kopela?  :-)

> 4    Eleni      Drakou
> 5    Lena      Matra
> 6    Dimitra   Lykopoulou
> 7    Alejia     Manta
> 8    Anna      Kotsopoulou
> 
>  Afairw gia paradeigma tin grammi 5 apo to arxeio "step-ena" me tis
> entoles :
> echo "Poia grami na sbisw apo to arxeio? dwse ID: "
> read deleteID (.....edw dinw as ypo8esoume  tin grammi 5)
> grep -v "^$deleteID" step-ena > neo-arxeio
> 
> Opote to arxeio "neo-arxeio" 8a periexei :
> $cat  neo-arxeio
> 1    Olga      Makri
> 2    Natalia  Kontou
> 3    Maria    Kamprianou
> 4    Eleni      Drakou
> 6    Dimitra  Lykopoulou
> 7    Alejia    Manta
> 8    Anna     Kotsopoulou
> 
> $ wc -l  neo-arxeio
>       7  neo-arxeio
> 
> Ayto pou zitaw apo esas, gia na me boi8isete, einai to ejis :
>   8elo na ekxwriso sto "neo-arxeio" sto pedio $1 nees times. Oi times
> aytes 8a einai oi
> grammes.

Se awk:

awk '{print FNR, $2, $3}' neo-arxeio > allo-arxeio

Tha mporousa na sou grapsw kai se perl, alla mallon tha einai megalytero.
To kako einai oti den kserw sed (pou mallon kai ekei tha grafotan omorfa :-)

<snip>

Michalis Kabrianis

P.S. Please apefeyge ta html mails.

--
====================================================================
Gia boithia (h na diagrafhte) e-mail sto majordomo at hellug.gr
Ta archives tis listas einai sto http://lists.hellug.gr/lgu.html
prin steilete kapoia erothsh psakte mipos exei hdh apanththei.
Gia opoiodipote problima stilte e-mail ston owner-linux-greek-users at hellug.gr
====================================================================



More information about the Linux-greek-users mailing list