日期:2014-05-16 浏览次数:20838 次
[root@RHEL6A tmp]# cat data8.txt aa 11 ab 22 ac 33 [root@RHEL6A tmp]# awk 'BEGIN{i=1}{i=i*(-1);if(i==-1) printf("%s=",$0);else print $0}' data8.txt aa=11 ab=22 ac=33 [root@RHEL6A tmp]# awk 'BEGIN{i=1}{i=i*(-1);if(i==-1) printf("%s=",$0);else print $0}' data8.txt > temp11.txt && source temp11.txt && echo $aa 11
------解决方案--------------------
#!/bin/bash awk '{printf("%s",$0);getline;print "="$0;}' $1