|
|
Zeile 1: |
Zeile 1: |
| Das Kommandozeilenwerkzeug von Sydro <code>SydroCmd.exe</code> kann als alleinstehendes Werkzeug benutzt werden oder über den [[Arbeiten mit dem TaskSrv|TaskServer]] konfiguriert und aufgerufen werden. Es wird im Pre- und Postprocessing sowie im Operationellen Einsatz von Talsim-NG genutzt. | | Das Kommandozeilenwerkzeug von Sydro <code>SydroCmd.exe</code> kann als alleinstehendes Werkzeug benutzt werden oder über den [[Arbeiten mit dem TaskSrv|TaskServer]] konfiguriert und aufgerufen werden. Es wird im Pre- und Postprocessing sowie im Operationellen Einsatz von Talsim-NG genutzt. |
|
| |
|
| ==[[Anwendung des SydroCmd-tools]]==
| | *[[Anwendung des SydroCmd-tools]] |
| Die Anwendung des SydroCmd tools ist sehr simpel.
| | *[[SydroCmd-Verzeichnisstruktur und Dateien]] |
| Es wird über die Kommandozeile aufgerufen zusammen mit dem Schlüssel für den auszuführenden Befehl und den dazugehörenden Argumenten, jeweils getrennt durch ein Leerzeichen:
| | *[[SydroCmd Befehle]] |
| | |
| <code>SydroCmd -command Arg1 Arg2 Arg3 Arg4</code>
| |
| | |
| ==[[SydroCmd-Verzeichnisstruktur und Dateien]]==
| |
| Da das SydroCmd-tool oft vom TaskServer aus gestartet wird empfiehlt es sich sämtliche zum SydroCmd-tool gehörenden Dateien in dasselbe [[TaskSrv-Verzeichnis:_Exe|Verzeichnis]] wie die ausführbare Programmdatei des TaskServers zu legen.
| |
| | |
| ===SydroCmd.exe===
| |
| | |
| ==[[SydroCmd Befehle]]==
| |
| | |
| ===Extract===
| |
| Extracts strings from each line within an ASCII file.
| |
| | |
| {| class="wikitable" style="width: 50%;"
| |
| !style="width: 10%"|Argument
| |
| !style="width: 90%"|Description
| |
| |-
| |
| |Key
| |
| |<code>-extract</code>
| |
| |-
| |
| |1
| |
| |sourcefile
| |
| |-
| |
| |2
| |
| |<code>-string</code> or <code>-pos</code> or <code>-split</code> <br />(<code>-string</code>=search for a string, <code>-pos</code>=select a position, <code>-split</code>=delimits the string)
| |
| |-
| |
| |3
| |
| |either string or position as a number
| |
| |-
| |
| |4
| |
| |<code>-endstring</code> or <code>-endlen</code> or <code>-array</code>
| |
| |-
| |
| |5
| |
| |either a string or the work blank or a position as integer, depending on the previous argument. With <code>-split</code> a comma-separated list of indices is required indicating which items should be saved
| |
| |-
| |
| |6
| |
| |targetfile
| |
| |}
| |
| | |
| | |
| ;Example1
| |
| :extracts a string from each line within <code>d:\temp\abc.txt</code> which follows directly after <code>val=</code> and ends at the next blank.
| |
| :<code>SydroCmd -extract d:\temp\abc.txt -string :val= -endstring blank d:\temp\extract.txt</code>
| |
| | |
| ;Example 2
| |
| : extracts a string from each line within d:\temp\abc.txt starting from position 15 with a length of 25 characters.
| |
| :<code>SydroCmd -extract d:\temp\abc.txt -pos 15 -endlen 25 d:\temp\extract.txt</code>
| |
| | |
| | |
| ===Download===
| |
| Downloads a file with a valid URL to the local memory.
| |
| | |
| {| class="wikitable" style="width: 50%;"
| |
| !style="width: 10%"|Argument
| |
| !style="width: 90%"|Description
| |
| |-
| |
| |Key
| |
| |<code>-download</code>
| |
| |-
| |
| |1
| |
| |URL (possibly with spaceholders like <code>{0}</code>
| |
| |-
| |
| |2
| |
| |Arguments separated by a comma filling the spaceholders in the URL
| |
| |-
| |
| |3
| |
| |targetfile
| |
| |}
| |
| | |
| ;Example
| |
| :Downloads a file from the NOAA data archive. Variables are the year, month, day.
| |
| :<code><nowiki>SydroCmd -download http://nomads.ncdc.noaa.gov/modeldata/cfsv2_forecast_mm_9mon/{0}/{0}{1}/{0}{1}{2}/{0}{1}{2}00/flxf.01.{0}{1}{2}00.{3}{4}.avrg.grib.grb2 2016,12,02,2016,12 D:\temp\tmp.grb2 </nowiki></code>
| |
| | |
| ===Replace===
| |
| Replaces all strings with a new string within a file. Is able to handle current date information.
| |
| | |
| {| class="wikitable" style="width: 50%;"
| |
| !style="width: 10%"|Argument
| |
| !style="width: 90%"|Description
| |
| |-
| |
| |Key
| |
| |<code>-replace</code>
| |
| |-
| |
| |1
| |
| |sourcefile
| |
| |-
| |
| |2
| |
| |string to be searched for (see options)
| |
| |-
| |
| |3
| |
| |Replacement string, string to be inserted (see options)
| |
| |-
| |
| |4
| |
| |targetfile (if not given, sourcefile will be overwritten)
| |
| |}
| |
| | |
| ====Options====
| |
| ;2. Argument
| |
| : String to be searched for that will be replaced
| |
| : Format= <code>[KEYWORD|Valid Formatstring|Valid Number,DateInterval} </code>
| |
| ::<code>KEYWORD = CURRENTDATE</code>
| |
| ::<code>Valid Formatstring</code> = possible is <code>yyy</code>, <code>MM</code>, <code>dd</code>, <code>mm</code>
| |
| ::<code>Valid Number</code>= <code>0, +2, -5</code> or any other integer (adds/subtracts the number of years, months, days, hours, minutes as given with the number)
| |
| ::<code>DateIntervall</code>= <code>y, M, d, h, m</code> (is used to add the <code>valid number</code> to the date)
| |
| :Example: <code>{CURRENTDATE|dd|+1,d}</code> with a date 30/12/2017 results in 31
| |
| | |
| ;3. Argument
| |
| : ordinary string or in combination with <code>CURRENTDATE</code> a date in the format <code>yyyyMMDDhhmm</code> or the keyword <code>Now</code>
| |
| | |
| ====Examples====
| |
| ;Example1
| |
| :simple with “hallo” replaced by “goodbye”. The sourcefile will be overwritten.
| |
| :<code>SydroCmd -replace d:\temp\abc.txt hallo goodbye </code>
| |
| | |
| ;Example2
| |
| :with date information
| |
| :<code>SydroCmd -replace d:\temp\abc.txt CURRENTDATE 201612050000 d:\temp\abcnew.txt</code>
| |
| :In this example the first argument is <code>CURRENDATE</code> indicating that date information is used. If this string is found it will be replaced by the date given in the next argument (here <code>5/12/2016 00:00</code>). In the <code>abc.txt</code> the variable to be replaced must be given as follows: <code>{CURRENTDATE|yyyy|+1,y}</code>. This means the result will be ‘2017’, one year added to 2016.
| |
| | |
| ===Zip===
| |
| Zips files into a Zip File Format.
| |
| | |
| {| class="wikitable" style="width: 50%;"
| |
| !style="width: 10%"|Argument
| |
| !style="width: 90%"|Description
| |
| |-
| |
| |Key
| |
| |<code>-zip</code>
| |
| |-
| |
| |1
| |
| |source directory
| |
| |-
| |
| |2
| |
| |zipfilename
| |
| |-
| |
| |3
| |
| |<code>-pattern</code> or <code>-list</code>
| |
| |-
| |
| |4
| |
| |the pattern or a comma-separated list
| |
| |}
| |
| | |
| ;Example 1:
| |
| :Compresses all files in directory <code>d:\temp\</code> with <code>*.txt</code>-extension to file <code>myfile.zip</code>
| |
| :<code>SydroCmd -zip d:\temp\ myfile.zip -pattern *.txt</code>
| |
| | |
| ;Example 2:
| |
| :Compresses a list of files in directory <code>d:\temp\</code> with <code>*.txt</code>-extension to file <code>myfile.zip</code>
| |
| :<code>SydroCmd -zip d:\temp\ myzipfile.zip -list d:\mylist\file1.txt "d:\many files\newfile.doc"</code>
| |
| | |
| | |
| ===UnZip===
| |
| UnZips files from a Zip File.
| |
| | |
| {| class="wikitable" style="width: 50%;"
| |
| !style="width: 10%"|Argument
| |
| !style="width: 90%"|Description
| |
| |-
| |
| |Key
| |
| |<code>-unzip</code>
| |
| |-
| |
| |1
| |
| |source directory
| |
| |-
| |
| |2
| |
| |source zipfilename
| |
| |-
| |
| |3
| |
| |<code>-pattern</code> or <code>-list</code>
| |
| |-
| |
| |4
| |
| |the pattern or a comma-separated list
| |
| |}
| |
| | |
| ;Example 1:
| |
| : Unzips all files in directory <code>d:\temp\</code> and zipfile <code>myfile.zip</code> with the pattern <code>*.txt</code> to <code>d:\</code>
| |
| :<code>SydroCmd -unzip d:\ d:\temp\myfile.zip -pattern *.txt</code>
| |
| | |
| ;Example 2:
| |
| :Unzips a selection of files from <code>d:\temp\</code> and <code>myzipfile</code> to <code>d:\</code>
| |
| :<code>SydroCmd -unzip d:\ d:\temp\myzipfile.zip -list d:\mylist\file1.txt "d:\any directory\newfile.doc"</code>
| |
| | |
| ;Expamle 3:
| |
| :Unzips all files in the zipfile from <code>d:\temp\</code> and <code>myzipfile</code> to <code>d:\</code>
| |
| :<code>SydroCmd -unzip d:\ d:\temp\myzipfile.zip -pattern *.*</code>
| |