I need to understand why I am not able to execute the following.
ls -d /data/VT60000* | xargs -IDIRECTORY find DIRECTORY -type f -iname RJ\*.xml | xargs -IFILE sh -c ' XML=$( xmlstarlet fo -D "FILE" );
EXTRACT=$( xmlstarlet sel -t -c "concat('JD',/root/item1,/root/item2)" <<< "$XML" );
echo '$EXTRACT'; '
I have a bunch of folders which contains thousands XML files. I would like to extract information from these files and then manipulate them for later processing. The reason why I am piping them is because I would like to execute multiple processes (-P)
The second xmlstarlet fails to execute and I fail to understand why.
The question is how can i achieve this.? To get a value in $EXTRACT.
Thanks for the assistance in advance.
ls
? – Cyrus Jan 20 '18 at 18:37xargs sh -c 'XML=$(xmlstarlet)'
runs multiple times? Should the later calls write over the values of the earlier calls (like would happen if you assigned them to a variable one by one), or should the values be concatenated, or ...? – ilkkachu Jan 20 '18 at 18:52