我想将查询结果存储到 k-shell 脚本中的变量中。这是到目前为止我所做的:
WeekEndingDate=`nzsql << endl | grep KEEP | sed 's/KEEP//;s/[ ]//g'
select 'KEEP', max(Week1) from Table_Week;
endl`
echo Week ending date: $WeekEndingDate
MonthEndingDate=`nzsql << endl | grep KEEP | sed 's/KEEP//;s/[ ]//g'
select 'KEEP', max(Month1) from Table_Week;
endl`
echo Month ending date: $MonthEndingDate
当我运行它时的结果是:
Week ending date: |2013060801
Month ending date: |2013060804
有一个带有前缀的管道。我只需要没有管道的结果:
Week ending date: 2013060801
Month ending date: 2013060804
请帮我解决一下这个。
谢谢。