データのタイムスタンプをファイル名にする

まずは、タイムスタンプを変数として取得する

'q dims'
dim_result = result
dim_time = sublin(dim_result,5)
time = subwrd(dim_time,6)
hour = substr(time,1,2)
day = substr(time,4,2)
month = substr(time,6,3)
year = substr(time,9,4)

あとは、printimで指定するだけ。ただし、/(スラッシュ)は使えないので注意

'printim hoge' year'_'month'_'day'_'hour'.png'

この結果として例えば、hoge2010_AUG_22_12.png といったファイルが作成される。

月名を数字に変更する

月の名前が英語名のままだとlsしたときに順番に並ばないので、数字に変換したい場合は以下をスクリプトに追加する。

if(month='JAN');month='01';endif
if(month='FEB');month='02';endif
if(month='MAR');month='03';endif
if(month='APR');month='04';endif
if(month='MAY');month='05';endif
if(month='JUN');month='06';endif
if(month='JUL');month='07';endif
if(month='AUG');month='08';endif
if(month='SEP');month='09';endif
if(month='OCT');month='10';endif
if(month='NOV');month='11';endif
if(month='DEC');month='12';endif
最終更新:2011年12月01日 12:04