# web-grep ## What this? Grep for HTML or XML. ```bash $ echo 'Hello' | web-grep '{}' Hello ``` ```bash $ echo 'Hello' | web-grep '{html}' --json {"html":"Hello"} ``` ```bash # List up all
-innerHTML $ cat << EOM | web-grep '
{}
'hello
world
{}
'hello
world
world
'hello
world
{}
``` ```html
{}
1
2
3
" | web-grep "{}
" 1 2 3 ``` ### Numbered Placeholders `{n}` ```html {2} ``` `web-grep` outputs matched texts for `{1}`, `{2}`... in order, separated by `\t`. ```bash $ echo 'fuga' | web-grep "{1}" fuga hoge ``` The delimiter can be specified with `-F`. ```bash $ echo 'fuga' | web-grep "{1}" -F ' ' fuga hoge ``` ### Named Placeholders `{xxx}` ```html {innerHTML} ``` The output can be formatted as JSON with `--json`. ```bash $ echo 'fuga' | web-grep "{html}" --json {"href":"hoge","html":"fuga"} ```