Skip to content

ahmadrosid/greph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Greph

Just like grep but for html document.

Demo

Install

Clone repository :

git clone https://github.com/ahmadrosid/greph.git

Compile :

go test
go build
go install

Usage

Grep from url :

greph https://example.com "p[0].text"

Grep from stdin :

echo "<p>Paragraph</p>" | greph "p[0].text"

Query

Format selector[index]extractor.

Selector

Select by tag :

echo "<p>Paragraph</p>" | greph "p[0].text"

Select by class :

echo "<h1 class="title">Title</h1>" | greph ".title[0].text"

Index

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"

Extractor

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"

About

🔭 It's like grep but for html

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages