Repeat printf arguments with command line operators

烈酒焚心 提交于 2020-03-26 07:34:28

问题


I want to repeat the same argument $i for the instances 03-12. I'm really trying to use some nco operators - but the printf statement is hanging me up. I'm trying to use an netcdf operator on it - where these outputs of the printf are the input files to the command. While this works now with the printf statements, it's not piping into the netcdf command. Which goes as: ncea -v T,U inputfiles outputfile

#!/bin/csh                                                                                                                                                                                                                                             
set i = 1
while ($i < 2)
    ncea -v T,U
    foreach j ( {3,4,6,7,8,9,10,11,12} )
        `printf O3_BDBP_1979ghg.cam.h0.00%02d-%02d.nc $j $i `
    end

    O3_BDBP_1979.nc
    @ i = $i + 1
end

Other printf statements I've tried are

ncea -v T,U `printf O3_BDBP_1979ghg.cam.h0.00{03,04,05,06,07,08,09,10,11,12}-%02d.nc $i` O3_BDBP_1979.nc
ncea -v T,U `printf O3_BDBP_1979ghg.cam.h0.00{03,04,05,06,07,08,09,10,11,12}-%1$02d.nc $i` O3_BDBP_1979.nc

来源:https://stackoverflow.com/questions/18834954/repeat-printf-arguments-with-command-line-operators

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!