Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
8566e474
Kaydet (Commit)
8566e474
authored
Eki 22, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added pgrep() function, which is like grep/egrep/emgrep but uses Perl
syntax, by virtue of the new re module.
üst
b4914424
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
grep.py
Lib/grep.py
+18
-0
grep.py
Lib/lib-old/grep.py
+18
-0
No files found.
Lib/grep.py
Dosyayı görüntüle @
8566e474
...
@@ -38,6 +38,24 @@ def ggrep(syntax, pat, files):
...
@@ -38,6 +38,24 @@ def ggrep(syntax, pat, files):
showline
(
filename
,
lineno
,
line
,
prog
)
showline
(
filename
,
lineno
,
line
,
prog
)
fp
.
close
()
fp
.
close
()
def
pgrep
(
pat
,
*
files
):
if
len
(
files
)
==
1
and
type
(
files
[
0
])
==
type
([]):
files
=
files
[
0
]
global
opt_show_filename
opt_show_filename
=
(
len
(
files
)
!=
1
)
import
re
prog
=
re
.
compile
(
pat
)
for
filename
in
files
:
fp
=
open
(
filename
,
'r'
)
lineno
=
0
while
1
:
line
=
fp
.
readline
()
if
not
line
:
break
lineno
=
lineno
+
1
if
prog
.
search
(
line
):
showline
(
filename
,
lineno
,
line
,
prog
)
fp
.
close
()
def
showline
(
filename
,
lineno
,
line
,
prog
):
def
showline
(
filename
,
lineno
,
line
,
prog
):
if
line
[
-
1
:]
==
'
\n
'
:
line
=
line
[:
-
1
]
if
line
[
-
1
:]
==
'
\n
'
:
line
=
line
[:
-
1
]
if
opt_show_lineno
:
if
opt_show_lineno
:
...
...
Lib/lib-old/grep.py
Dosyayı görüntüle @
8566e474
...
@@ -38,6 +38,24 @@ def ggrep(syntax, pat, files):
...
@@ -38,6 +38,24 @@ def ggrep(syntax, pat, files):
showline
(
filename
,
lineno
,
line
,
prog
)
showline
(
filename
,
lineno
,
line
,
prog
)
fp
.
close
()
fp
.
close
()
def
pgrep
(
pat
,
*
files
):
if
len
(
files
)
==
1
and
type
(
files
[
0
])
==
type
([]):
files
=
files
[
0
]
global
opt_show_filename
opt_show_filename
=
(
len
(
files
)
!=
1
)
import
re
prog
=
re
.
compile
(
pat
)
for
filename
in
files
:
fp
=
open
(
filename
,
'r'
)
lineno
=
0
while
1
:
line
=
fp
.
readline
()
if
not
line
:
break
lineno
=
lineno
+
1
if
prog
.
search
(
line
):
showline
(
filename
,
lineno
,
line
,
prog
)
fp
.
close
()
def
showline
(
filename
,
lineno
,
line
,
prog
):
def
showline
(
filename
,
lineno
,
line
,
prog
):
if
line
[
-
1
:]
==
'
\n
'
:
line
=
line
[:
-
1
]
if
line
[
-
1
:]
==
'
\n
'
:
line
=
line
[:
-
1
]
if
opt_show_lineno
:
if
opt_show_lineno
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment