This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hi Terri, re: > I am setting up a pqact.conf entry to get files from a new customer, > and I need to convert the EPOC timestamp that they have in the > filename to the UTC date. > > For example, the file in their queue looks like this: > > XXX_OBS.CSV.1510574817 > > and I will need to convert it to look like this: > > xxx_obs.YYYYMMDD.hhmm.csv > > In bash it’s a piece of cake: > > # date -d @1510574817 +%Y%m%d.%H%M > 20171113.1206 > > Have you had anyone write a util to do this, or am I on my own? :-) I'm sure that someone has written a script to do the conversion, but no such thing is part of the LDM distribution. Since you already know how to convert the epoch date into the form you want, why not simply PIPE the received product(s) to a BASH script in which you use 'cut' to extract the epoch timestamp and then run 'date' to product the desired date/time and finally write the product to an output file using the name you want? I do the same sort of thing in a BASH script that I run in an LDM pattern-action action where I need to convert a date/time string in the form: CCYYJJJHHMMSS where JJJ is the day of the year number. to: CCYYMMDDHHMMSS Like you, I am using 'date' to do the conversion. NB: - any LDM pattern-action file action to which a product is PIPEd is responsible for reading the entire product before exiting If your action does not read the entire product, 'pqact' will think that the action has failed for some reason, and it will run it once more. Cheers, Tom -- **************************************************************************** Unidata User Support UCAR Unidata Program (303) 497-8642 P.O. Box 3000 address@hidden Boulder, CO 80307 ---------------------------------------------------------------------------- Unidata HomePage http://www.unidata.ucar.edu **************************************************************************** Ticket Details =================== Ticket ID: UFM-160152 Department: Support LDM Priority: Normal Status: Closed =================== NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.