Commercial
sed is a generally used for reformatting textual content. grep, head are sometimes good selection for easy duties. However, jq and htmlq are specialised instruments which price testing to your developmental want. Each are comparable instruments, written in Rust and might be put in on Home windows PC operating Ubuntu Bash, Linux PC and MacOS X. For Mac, we’ll counsel to make use of Dwelling Brew as package deal supervisor.
|
# instructions for Ubuntu/Debian sudo apt set up cargo cargo set up htmlq sudo apt set up jq
# instructions for MacOS brew set up rustup # installs cargo and rustc rustup–init rustc —model cargo set up htmlq brew set up jq |
Make your so as to add the appropriate path to your .profile
file (what’s profile file):
|
# for sh, bash and so on export PATH=“$PATH:$HOME/.cargo/bin” # for the others setenv PATH $PATH:$HOME/.cargo/bin |
You possibly can learn the person web page and in addition can attempt jq on-line:
We will use echo and jq collectively:
|
echo ‘[ {“value”: “New”, “onclick”: “CreateNewDoc()”}, {“value”: “Open”, “onclick”: “OpenDoc()”} ]’ | jq ‘.[]’ |
We will mix cURL and jq (this instance is offered by Linode):
|
curl ‘https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia/all-access/all-agents/Talking_Heads_discography/every day/20210928/20210930’ | jq ‘.’ </p;re>
We can discover all the hyperlinks on our homepage utilizing cURL and htmlq:
<pre> curl –s https://thecustomizewindows.com | htmlq —attribute href a |
sed, grep, head and so on instruments have limitations. In widespread utilization, they’re the very best instruments and handy to make use of in bash scripts. jq, htmlq are good for private utilization on native pc. These instruments may additionally make it easier to in IoT improvement.