+ -
当前位置:首页 → 问答吧 → 参数值 传入 print

参数值 传入 print

时间:2011-07-14

来源:互联网

cat 1.txt

123   456

输出

123  456   “当前时间"


date = `date +%s`

awk '{print $1,$2,$date}' 1.txt  不行嘛

作者: sunlizhourong   发布时间: 2011-07-14

参数$date值传不进去

作者: sunlizhourong   发布时间: 2011-07-14

try:
awk '{print $0,'"$date"'}' 1.txt

作者: where27   发布时间: 2011-07-14

谢谢楼上  刚试了不行

作者: sunlizhourong   发布时间: 2011-07-14

回复 sunlizhourong
  1. [root@ZB-MS-TEST01 test]# cat 1.txt
  2. 123 456
  3. [root@ZB-MS-TEST01 test]# date=`date +%s`
  4. [root@ZB-MS-TEST01 test]# awk '{print $0,'"$date"'}' 1.txt
  5. 123 456 1310633103
复制代码

作者: where27   发布时间: 2011-07-14

正解 谢谢

作者: sunlizhourong   发布时间: 2011-07-14

热门下载

更多