sed
Antonios-Kornilios Kourtis
el99027 at mail.ntua.gr
Wed Jul 28 02:35:46 EEST 2004
On Wed, Jul 28, 2004 at 01:43:47AM +0300, Antonios-Kornilios Kourtis wrote:
> On Wed, Jul 28, 2004 at 12:36:20AM +0300, Nikos Kanellopoulos wrote:
> > Ξέρεις κανείς πώς γίνεται με το sed
> > κάτι ανάλογο με το grep -o ;
>
> Egw kapws etsi 8a to ekana :
>
> sed -n 's/.*\(match\).*/\1/p'
>
Basika paizontas ligo parathrhsa oti auto pou grafw parapanw (kai to
antistoixo tou Giorgou) den exei _akribws_ to idio apotelesma me to
grep -o
gia paradeigma:
$ cat > foo
lala koko lala
lala lala
koko lala
$ grep -o lala <foo
lala
lala
lala
lala
lala
$ sed -n 's/.*\(lala\).*/\1/p' < foo
lala
lala
lala
Mia aplh (sxetika) lysh gia petyxoume to idio
apotelesma me to grep -o 8a mporouse na einai:
$ sed -n -e 's/[^lala]/\n/pg' < foo | sed -e '/^$/d'
lala
lala
lala
lala
lala
An kai mallon yparxoun kai pio swstoi (TM) tropoi :-)
--
Kornilios Kourtis
More information about the Linux-greek-users
mailing list