3 ms·
That's a really fun idea. I got that working here: https://til.simonwillison.net/bash/go-script https://til.simonwillison.net/bash/go-script Now you can run th
by simonw 3y ago
That's a really fun idea. I got that working here: https://til.simonwillison.net/bash/go-script https://til.simonwillison.net/bash/go-script
Now you can run this:
cat file.txt | ./goscript.sh -c 'script.Stdin().Column(1).Freq().First(10).Stdout()'
Or write scripts like this - call it 'top10.sh':
#!/tmp/goscript.sh
script.Stdin().Column(1).Freq().First(10).Stdout()
Then run this:
chmod 755 topten.sh
echo "one\none\ntwo" | ./topten.sh
- moondev 3y agoThis is fantastic. Thanks for sharing and also including docs on your process and usage!