shell脚本,awk实现每个数字加1.

[root@localhost add]# cat file 
1 3 4 5
7 8 9
[root@localhost add]# cat file|awk '{for(i=1;i<=NF;i++){$i+=1}}1'
2 4 5 6
8 9 10
[root@localhost add]# cat file|awk '{for(i=1;i<=NF;i++){$i+=1}}1{print $0}'
2 4 5 6
8 9 10
[root@localhost add]# cat file|awk '{for(i=1;i<=NF;i++){$i+=1}}{print $0}'
2 4 5 6
8 9 10
[root@localhost add]# 
原文地址:https://www.cnblogs.com/wangyuebo/p/5851535.html