linux 中利用awk进行数值计算

 

001、方式1

[root@pc1 test1]# awk 'BEGIN{print 10 + 5}'
15
[root@pc1 test1]# awk 'BEGIN{print 10 / 5}'
2

 

002、方式2

[root@pc1 test1]# echo | awk '{print 10 + 5}'
15
[root@pc1 test1]# echo | awk '{print 10 / 5}'
2

。 

 

posted @ 2024-02-19 16:56  小鲨鱼2018  阅读(45)  评论(0编辑  收藏  举报