next up previous
Next: Oddzielanie powtarzających się linii; Up: wyklad6 Previous: Zliczanie linii, słów i

Wyszukiwanie wzorca w pliku/plikach (polecenie grep; Global REgular exPression search)

[adam@etoh ~]$ grep 'for' Twain
would be the "ch" formation, which will be dealt with later.  Year 2
might reform "w" spelling, so that "which" and "one" would take the
"i" and Iear 4 might fiks the "g/j" anomali wonse and for all.
        Fainali, xen, aafte sam 20 iers ov orxogrefkl riform, wi wud

[adam@etoh ~]$ grep -i ' for ' Twain
        For example, in Year 1 that useless letter "c" would be dropped
"i" and Iear 4 might fiks the "g/j" anomali wonse and for all.

[adam@etoh ~]$ grep -ni ' for ' Twain
3:        For example, in Year 1 that useless letter "c" would be dropped
9:"i" and Iear 4 might fiks the "g/j" anomali wonse and for all.

[adam@etoh ~]$ grep -ci ' for ' Twain
2

[adam@etoh ~]$ grep -v "w" Twain

ov ould doderez -- tu riplais "ch", "sh", and "th" rispektivli.

[adam@etoh ~]$ grep '"[a-z]"' Twain
        For example, in Year 1 that useless letter "c" would be dropped
to be replased either by "k" or "s", and likewise "x" would no longer
be part of the alphabet.  The only kase in which "c" would be retained
might reform "w" spelling, so that "which" and "one" would take the
same konsonant, wile Year 3 might well abolish "y" replasing it with
"i" and Iear 4 might fiks the "g/j" anomali wonse and for all.
ridandant letez "c", "y" and "x" -- bai now jast a memori in the maindz

[adam@etoh ~]$ grep '^[A-Z]' Twain
Bai Iear 15 or sou, it wud fainali bi posibl tu meik ius ov thi

[adam@etoh ~]$ grep 'd$' Twain
        For example, in Year 1 that useless letter "c" would be dropped
be part of the alphabet.  The only kase in which "c" would be retained
        Fainali, xen, aafte sam 20 iers ov orxogrefkl riform, wi wud

[adam@etoh ~]$ grep -si 'veilind' *
sentencje:Veilind's law of experimentation:
suma:Veilind's law of experimentation:
suma:Veilind's law of experimentation:
veilind:Veilind's law of experimentation:

[adam@etoh ~]$ ls -l | grep '^d'
drwxr-xr-x   2 adam     users        4096 Jan 12  1998 CTC_talk
drwxr-xr-x   5 adam     users        4096 Feb  5  2000 Desktop
drwxr-xr-x   4 adam     users        4096 Oct 14 13:04 INTLOCAL
drwxr-xr-x   2 adam     users        4096 Apr  3  2000 PRO
drwxrwxrwx   9 adam     users        4096 May 12  2000 analyze
drwxr-x---   6 adam     users        4096 May 12  2000 g98
drwxr-xr-x   4 adam     users        4096 Oct 30 10:34 kopia.INTLOCAL
drwx------   2 adam     users        4096 May  4  2000 nsmail
drwxr-xr-x   3 adam     users        4096 Oct 30 11:55 nuevo
drwxr-xr-x  23 adam     users        4096 May  5  2000 src



Adam Liwo 2002-03-07