Just like grep but for html document.
Clone repository :
git clone https://github.com/ahmadrosid/greph.git
Compile :
go test
go build
go install
Grep from url :
greph https://example.com "p[0].text"
Grep from stdin :
echo "<p>Paragraph</p>" | greph "p[0].text"
Format selector[index]extractor
.
Select by tag :
echo "<p>Paragraph</p>" | greph "p[0].text"
Select by class :
echo "<h1 class="title">Title</h1>" | greph ".title[0].text"
Get one from index 0
:
greph https://example.com "p[0].text"
Get all bwtween index 2
and 5
:
greph https://example.com "p[2:5].text"
Get all until index 5
:
greph https://example.com "p[:5].text"
Extract the text from tag :
echo "<p>Paragraph</p>" | greph "p[0].text"
Extract the text from attributes :
echo "<a href="https://example.com">Title</h1>" | greph "a[0]:href"