Show HN: Pjs is an Awk-like CLI for processing textual formats with JavaScript(github.com)3 points·by aduros·6 ปีที่แล้ว·1 commentsgithub.comShow HN: Pjs is an Awk-like CLI for processing textual formats with JavaScripthttps://github.com/aduros/pjs1 commentsPost comment[–]aduros·6 ปีที่แล้วreplypjs is for filtering and transformation like awk/sed/grep, but it supports many different text-based formats and its programs are written in plain JavaScript.Here's an example that converts a file to uppercase: cat file.txt | pjs '_.toUpperCase()' It can also scrape websites using CSS selectors: curl https://aduros.com | pjs --html 'h1,h2' '_.text' And JSON using jq filters: cat database.json | pjs --json '.users[]' '_.age >= 21' Lots more examples on the README/man page. It's still quite new and may have bugs, if you find one let me know!
Here's an example that converts a file to uppercase:
It can also scrape websites using CSS selectors:
And JSON using jq filters:
Lots more examples on the README/man page. It's still quite new and may have bugs, if you find one let me know!