bash - 如何用awk在末尾添加新行

标签 bash shell awk printf newline

我搜索并尝试了很多不同的方法,但没有一种方法真正满足我的需要。 希望它之前没有被问过上百万次。

我的 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/

相关文章:

node.js - 在 Node.js 中执行 bash 命令并获取退出代码

python - os.system() 在哪个 linux shell 下执行命令?

windows - 通过命令提示符通过 bash 调用 ffmpeg

bash - 查找少于 2000 行的文本文件并删除它们

bash - 在 vi 中复制和粘贴

bash - 如何在 bash 中添加两个时间输出

python - 通过 subprocess.call 向 localhost 发出命令

shell - 用于确定循环中相对路径的批处理脚本

bash - if else 和 awk ... 我的命令需要更正

regex - 使用awk计算并打印正则表达式得到的值的平均值