我搜索并尝试了很多不同的方法,但没有一种方法真正满足我的需要。 希望它之前没有被问过上百万次。
我的 bashrc 中有这个别名:
alias temp='awk '\''{ printf ("%0.1f",$1/1000); }'\'' < /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input'
它的输出是:
measure@remote ~ $ temp
10.6measure@remote ~ $
我想要实现的是这样的输出:
measure@remote ~ $ temp
10.6
measure@remote ~ $
最佳答案
替换
"%0.1f"
与
"%0.1f\n"
关于bash - 如何用awk在末尾添加新行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48461783/