Hi,
I have to make an script according to these:
-
I have couples of files like:
xxxxxxxxxxxxx.csv
xxxxxxxxxxxxx_desc.xml -
every xml file has diferent fields, but keeps this format:
........
<defaultName>2011-02-25T16:43:43.582Z</defaultName>
........
<reportSearchPath>CAMID("ualdap:u:tekuid=USER,ou=people")/folder[@name='My Folders']/query[@name='TEST']</reportSearchPath>
......... -
So I have to make an script that, for every csv&xml couple, parse the xml file and takes date in format yyyymmdd_hhmmss, user (tekuid) and reportname (in the example above, 20110225_164358, USER and TEST). Once these 3 fields are extracted, both csv and xml files have to be renamed to this format:
reportname_yyyymmdd_hhmmss_user (.csv or .xml)
(in our example, TEST_20110225_164358_USER)
and moved to /reportname directory and /user directory (one copy in each directory)
My idea is a for loop obtained with a find command, the awk part to extract these 3 fields, and then the rename and move.
Could you please help me? I'm not an expert in scripting, specially in the awk part...
Thx in advance (and sorry for my English)