writing to a file

Krishnaraj Santhanam ksanthanam at PRECISIONWIND.COM
Mon Aug 11 17:00:39 EDT 2008


Thanks Charles,
Krishna
Charles Seman wrote:
> Krishnaraj,
>
> In a script, try something like:
>
> 'set t 1' * or whatever time you want from the GrADS input file...
> 'q time'
> date = subwrd(result,3)
>
> or if you want the actual date (see also Unix "man date", GrADS "read"
> and other functions at
> http://grads.iges.org/grads/gadoc/script.html#intrinsic):
>
> '!echo `date` > date_tmp'
> result = read(date_tmp)
> date = sublin(result,2)
> say date
> say subwrd(date,1)
> '!rm date_tmp'
> * or (there are other formats too...)
> '!echo `date +%D` > date_tmp'
> result = read(date_tmp)
> date = sublin(result,2)
> say date
> '!rm date_tmp'
>
> Then you can use "subwrd" and/or "substr" to get parts of the "date"...
>
> I hope this helps,
> Chuck
>
> Krishnaraj Santhanam wrote:
>> Hi,
>> I am trying to write some variables to a text  file.  I would like to
>> have have output file naming convention with the date format included in
>> it.
>> Any help would be appreciated.
>> Some thing like this
>>                    dum1=sublin(result,5)
>>                     date=subwrd(dum1,6)
>>                 write(out_"date".out,date)
>> Does anyone know how to do this.
>> Thanks for your time,
>> Krishna
>
> --
>
> Please note that Charles.Seman at noaa.gov should be considered my NOAA
> email address, not cjs at gfdl.noaa.gov.
>
> ********************************************************************
> Charles Seman                                Charles.Seman at noaa.gov
> U.S. Department of Commerce / NOAA / OAR
> Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
> 201 Forrestal Road                              fax: (609) 987-5063
> Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
> ********************************************************************
>
> "The contents of this message are mine personally and do not necessarily
> reflect any position of the Government or NOAA."



More information about the gradsusr mailing list