gurl is a golang >= v1.24 program that reads URLs and other common identifiers from standard input (STDIN)
It is designed to work with any terminal that can pipe visible text to external programs, such as st, alacritty, kitty, wezterm, or similar.
The primary use case is piping the currently visible terminal output into gurl.
I'm using st terminal with externalpipe patch to read/pipe current visible text to this program.
- Read input from
STDIN - Extract
URLsand otheridentifiers - Remove
duplicateresults - Support
customregular expressions - Optional
indexprefix for results - Optional extractor-based
prefixes - Limit number of items
| Name | Description |
|---|---|
| Email addresses | |
| hash | Short hexadecimal identifiers (7β12 chars) |
| hexcolor | HEX colors (CSS/Web) |
| ipv4 | IPv4 addresses |
| ipv6 | IPv6 addresses |
| domain | Domain names |
| mac | MAC addresses |
| path | File paths (absolute, relative, file://) |
| raw | Raw input lines |
| sha | SHA-1 or SHA-256 hashes |
| url | Web URLs (http, https, ftp, www) |
| uuid | UUIDs |
go install github.com/mateconpizza/gurl@latest$ gurl -h
Extract URLs from STDIN
Usage:
gurl [options]
Options:
-t, --type STR Comma-separated extractor types (default: url)
-E, --regex NAME=REGEX Register a custom extractor
-l, --list List built-in extractors
-n, --lines Limit number of results
-p, --prefix Prefix results with extractor name
-i, --index Prefix results with index number
-V, --version Show version and exit
-v, --verbose Enable verbose logging
-h, --help Show this help message$ gurl --prefix --type hash,sha,url,uuid,ipv4,mac < input.txt
hash:865ed41
sha:abb9a11544fbd3d2a283ced39c4400cd66daf3f5
url:https://github.com/mateconpizza/gm
uuid:3510b822-56f4-4f6d-a773-05efc0baa7e2
ipv4:1.1.1.1
mac:ff:ff:ff:ff:ff:ff
...
# Extract short commit hash
$ git log --oneline | fzf --multi | gurl -t hash
46c4bb9
4dada2e
865ed41
...The flag -E|--regex can be use for custom extractor.
# list existing remotes
$ gurl -t jira -E jira='^PROJ-\d+$' < data/jira.txt
PROJ-1
PROJ-12
PROJ-123
PROJ-0001
PROJ-99999
...Tip
To enable case-insensitive matching in your custom regex, use the (?i) gurl -t jira -E jira='(?i)^proj-\d+$' < data/jira.txt
Custom extractors use Go RE2 syntax.
- Syntax Reference: Google RE2 Syntax
- Testing Tool: regex101
