; docformat = 'rst' ; ; NAME: ; GENOIDE_XMLSETN ; PURPOSE: ; Update the number of epochs in the header of a Genoide VOTable file ; ;+ ; :Description: ; Update the number of epochs in the header of a Genoide VOTable file ; ; The suite of small routines GENOIDE_XML... allow to open, complete, close, read ; an XML file in the Genoid standards. ; ; :Categories: ; Disk I/O, Genoide ; ; :Params: ; FILE: in, required, type=string ; The path to the file to be updated ; nRow: in, required, type=integer ; Number of epochs to be set in the file ; ; :Author: ; B.Carry (IMCCE) ; ; :History: ; Change History:: ; Written in July 2013, B. Carry (IMCCE) ; 2013 Sep. - B.Carry (IMCCE) - Allow unknown number of rowk ;- pro genoide_xmlSetN, FILE, nRow ;--I-- Check for File Existance if ~file_exist(file) then begin message, /info, 'File not found' return endif ;--II-- Find the Line with the Number of Epoch spawn, 'grep -n obs.dat '+file, result, error split=strsplit( result, ':', /EXTRACT ) lineID = split(0) ;--III-- Format the New Line line = ' ' ;--IV-- Replace the Line Content spawn, "sed '"+strtrim(string(lineID,format='(I)'),2)+"s/.*/"+line+"/' < "+file+" > /tmp/genoid_toto.xml" spawn, 'mv /tmp/genoid_toto.xml '+file end