# Is there a way to "grep" inside REPL?

**URL:** <https://discourse.julialang.org/t/is-there-a-way-to-grep-inside-repl/47216>\
**Category:** General Usage\
**Tags:** question, repl\
**Created:** [September 24, 2020, 3:05pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-grep-inside-repl/47216 "2020-09-24T15:05:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HiroIshida](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hiroishida/32/7424_2.png) [@HiroIshida](https://discourse.julialang.org/u/HiroIshida)\
**Post date:** [September 24, 2020, 3:05pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-grep-inside-repl/47216/1 "2020-09-24T15:05:13Z")

</div>

Inside the REPL, for example, when I do `methods(HomogenousMesh)` from GeometryTypes.jl, I will get the following list of many signatures:

```julia
julia> methods(HomogenousMesh)
# 15 methods for type constructor:
[1] (::Type{HomogenousMesh})(vertices::Array{VertT,1}, faces::Array{FaceT,1}, normals::Array{NormalT,1}, texturecoordinates::Array{TexCoordT,1}, color::ColorT, attributes::AttribT, attribute_id::Array{AttribIDT,1}) where {VertT, FaceT, NormalT, TexCoordT, ColorT, AttribT, AttribIDT} in GeometryTypes at /home/hiro/.julia/packages/GeometryTypes/8vIFC/src/types.jl:169
[2] (::Type{HomogenousMesh})(vertices::AbstractArray{VertT,1}, faces::AbstractArray{FaceT,1}, normals::AbstractArray{NormalT,1}, texturecoordinates::AbstractArray{TexCoordT,1}, color::ColorT, attributes::AttribT, attribute_id::AbstractArray{AttribIDT,1}) where {VertT, FaceT, NormalT, TexCoordT, ColorT, AttribT, AttribIDT} in GeometryTypes at /home/hiro/.julia/packages/GeometryTypes/8vIFC/src/types.jl:187
[3] (::Type{M})(; kw_args...) where M<:HomogenousMesh in GeometryTypes at /home/hiro/.julia/packages/GeometryTypes/8vIFC/src/meshes.jl:105
[4] (meshtype::Type{T})(c::Union{HyperCube{3,T}, HyperRectangle{3,HT}}) where {T<:HomogenousMesh, HT} in GeometryTypes at /home/hiro/.julia/packages/GeometryTypes/8vIFC/src/primitives.jl:45
[5] (::Type{HM1})(primitive::HM2) where {HM1<:HomogenousMesh, HM2<:HomogenousMesh} in GeometryTypes at /home/hiro/.julia/packages/GeometryTypes/8vIFC/src/meshes.jl:60
[6] (::Type{M})(vertices::AbstractArray{Point{3,VT},1}, faces::AbstractArray{FT,1}) where {M<:HomogenousMesh, VT, FT<:Face} in GeometryTypes at /home/hiro/.julia/packages/GeometryTypes/8vIFC/src/meshes.jl:85
[7] (::Type{M})(attribs::Dict{Symbol,Any}) where M<:HomogenousMesh in GeometryTypes at /home/hiro/.julia/packages/GeometryTypes/8vIFC/src/meshes.jl:111
[8] (::Type{M})(mesh::AbstractMesh, attributes::Dict{Symbol,Any}) where M<:HomogenousMesh in GeometryTypes at /home/hiro/.julia/packages/GeometryTypes/8vIFC/src/meshes.jl:123
[9] (::Type{HM})(mesh::AbstractMesh, constattrib::ConstAttrib) where {HM<:HomogenousMesh, ConstAttrib} in GeometryTypes at /home/hiro/.julia/packages/GeometryTypes/8vIFC/src/meshes.jl:132
[10] (::Type{HM})(x::Tuple{P,ConstAttrib}) where {HM<:HomogenousMesh, ConstAttrib, P<:AbstractGeometry} in GeometryTypes at /home/hiro/.julia/packages/GeometryTypes/8vIFC/src/meshes.jl:152
[11] (meshtype::Type{T})(c::Pyramid) where T<:AbstractMesh in GeometryTypes at /home/hiro/.julia/packages/GeometryTypes/8vIFC/src/primitives.jl:3
[12] (::Type{T})(c::HyperSphere{2,T} where T) where T<:AbstractMesh in GeometryTypes at /home/hiro/.julia/packages/GeometryTypes/8vIFC/src/primitives.jl:29
[13] (::Type{T})(c::HyperSphere{2,T} where T, n) where T<:AbstractMesh in GeometryTypes at /home/hiro/.julia/packages/GeometryTypes/8vIFC/src/primitives.jl:29
[14] (meshtype::Type{T})(c::GeometryPrimitive, args...) where T<:AbstractMesh in GeometryTypes at /home/hiro/.julia/packages/GeometryTypes/8vIFC/src/primitives.jl:14
[15] (::Type{M})(points::AbstractArray{P,N} where N) where {M<:AbstractMesh, P<:Point} in GeometryTypes at /home/hiro/.julia/packages/GeometryTypes/8vIFC/src/polygons.jl:152

```

I want to do grep here, like

```julia
methods(HomogenousMesh) | grep Abstract

```

to extract all the lines which include the sequence `Abstract`. Is there a way to do this?

---

<div class="post-metadata">

**Author:** ![yha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yha/32/3502_2.png) [@yha](https://discourse.julialang.org/u/yha)\
**Post date:** [September 24, 2020, 3:28pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-grep-inside-repl/47216/2 "2020-09-24T15:28:20Z")

</div>

Something like this?

```julia
julia> methods(!)
# 3 methods for generic function "!":
[1] !(::Missing) in Base at missing.jl:100
[2] !(x::Bool) in Base at bool.jl:33
[3] !(f::Function) in Base at operators.jl:896

julia> collect(eachmatch( r".*operators.*", sprint(show,methods(!)) ))
1-element Array{RegexMatch,1}:
 RegexMatch("[3] !(f::Function) in Base at operators.jl:896")

```

---

<div class="post-metadata">

**Author:** ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)\
**Post date:** [September 24, 2020, 3:31pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-grep-inside-repl/47216/3 "2020-09-24T15:31:46Z")

</div>

> [@HiroIshida](#):
>
> `methods(HomogenousMesh) | grep Abstract`

Check out my package [NicePipes.jl](https://github.com/simeonschaub/NicePipes.jl), it does pretty much exactly that!
