From: Peter Kundrat <kundrat@NAPRI.SK>
Subject: Re: sed rada
Date: Fri, 27 Dec 1996 15:52:44 +0100
Next Article (by Author): Re: SCSI Petr Kopriva
Previous Article (by Author): Re: bootp "Pavlicek Lubos,VC,UID=1017"
Top of Thread: sed rada Matus Uhlar
Articles sorted by: [Date]
[Author]
[Subject]
Michal Kratky writes: > > Dobry den... > > > > mam sed skriptik ktory mi prehadzuje znaky za ine, napriklad 'ch' meni na > > 'x' a podobne... > > > > Nevie mi niekto poradit rychly jednoduchy a efektivny sposob ako z tohto > > vynechat prve pole ? (po prvu medzeru) > > > Regularni vyraz by to mel zvladnout ne ? > s/^\([^ ]\)*\( +\)\(.*\)ch/\1 \3x/g > Ale nevyzkousel jsem to. Zejmena nevim, jak se to zatvari na to > koncove g . Tu je jednak ten problem, ze * zozerie co najviac, teda vsetky ch a nahradi iba posledne. A vlastne .. po prvom nahradeni skonci za prvym ch, a teda dalsia porovnanie s /^/ skonci neuspesne. Obist by sa to dalo takto: sed -ne 'h;s/\([^ ]*\).*/\1/;x;s/^[^ ]*//;s/ch/x/g;H;x;s/\n//p' (gnu sed, neskusal som pozerat ci to vedia aj ine, ale snad ano). Vyzera to dost neprijemne, asi by to bolo citatelnejsie v perl-e/awk. pk -- kundrat@napri.sk, Peter KUNDRAT, http://www.napri.sk/~kundrat/, eeagle on irc
Next Article (by Author): Re: SCSI Petr Kopriva
Previous Article (by Author): Re: bootp "Pavlicek Lubos,VC,UID=1017"
Top of Thread: sed rada Matus Uhlar
Articles sorted by: [Date]
[Author]
[Subject]