Linux-Bulgaria.ORG
навигация

 

начало

пощенски списък

архив на групата

семинари ...

документи

как да ...

 

 

Предишно писмо Следващо писмо Предишно по тема Следващо по тема По Дата По тема (thread)

Re: lug-bg: grep, sed, cut - output manipulating


  • Subject: Re: lug-bg: grep, sed, cut - output manipulating
  • From: valery@xxxxxxxxxx (Valery Dachev)
  • Date: Sun, 9 Sep 2001 13:02:25 +0300 (EEST)



On Sun, 9 Sep 2001, George Danchev wrote:

> imam sledniq vupros:
> grep-vam po daden patern , oba4e iskam da se output-vat samo stringovete
> otgovarqsti na kriteriq, a ne celite redove. Primer sys slu4aen input:
> cat random_text.txt | grep appl
> ste output-ne celi redove sydyrzhasti "app", no kak da gi "iz4istq" taka, 4e
> da se output-vat samo stringove otgovqrqsti na patern-a - primerno apple ,
> application i t.n.?

input.txt:
        banana
        apple
        lemon
        peach
cat input.txt | egrep "(lemon|apple)"

> izvesten po podredba (predvidim) input:
> primerno:
> #!/bin/bash
> IP=`ifconfig |grep 212.*`
>
> mozhe li da se output-ne za dadeniq line, samo char-ovete primerno ot 10-25
> vklu4itelno i nisto drugo ?

Towa ne go razbrah.

> "interval" i "TAB" susto li se broqt za char ?

Obiknoweno da. Za da gi izbegnesh, movesh da naprawish taka:

input.txt:
        asd asdasda      asdasd 	asdasdasd
cat input.txt | awk '{print $1}'

za da wzemesh pyrwata kolonka.

> "cut" i "sed" bi trqbvalo da pomognat v slu4aq ama nesto nezacepvam kak
> da gi vpregna da svurshat rabota ili mozhe bi stava i po drug na4in ?

"cut" movesh da izpolzwash pri ednosimwolni razdeliteli. "sed" glawno za
zamestwane na tekts ot input-a s regexp. Wsyshtnost poslednoto movesh da go
realizirash kato zamestish interwalite i tabs w teksta s interwali ili drug
delimiter i posle go prekarash prez cut.

Ako imash obache nqkakyw po-sloven input, po-dobre e da go prekarash prez
nqkoj Perl script, zashtoto ima dobri wyzmovnosti za obrabotka na tekst s
regexps.

. . . . . . . . .			      Best regards, Valery Dachev
.........................................................................
: User ID      : Valery Dachev <valery@xxxxxxxxxx>                      :
: Homepage     : http://valery.zonebg.com/                              :
: PGP Key ID   : 1024D/1C4C9712 (DSA)                                   :
: Fingerprint  : C451 0CC8 8EB4 655C D7C8  9D7F DCE9 C14E 1C4C 9712     :
:..............:........................................................:
: Organization : Bulgarian GNU/Linux Society <info@xxxxxxxxxxxxxxxx>    :
: Homepage     : http://linux.zonebg.com                                :
:..............:........................................................:

===========================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers)
http://www.linux-bulgaria.org/ Hosted by Internet Group Ltd. - Stara Zagora



 

наши приятели

 

линукс за българи
http://linux-bg.org

FSA-BG
http://fsa-bg.org

OpenFest
http://openfest.org

FreeBSD BG
http://bg-freebsd.org

KDE-BG
http://kde.fsa-bg.org/

Gnome-BG
http://gnome.cult.bg/

проект OpenFMI
http://openfmi.net

NetField Forum
http://netField.ludost.net/forum/

 

 

Linux-Bulgaria.ORG

Mailing list messages are © Copyright their authors.