How to pass filepaths in text file as input to another FOR loop?

I am using C Shell.

My current working xmlstarlet command:

foreach xmlfile ( Test2/ResultReport1.xml Test3/ResultReport2.xml ) xmlstarlet sel -t -m '//RESULT_STEP' -v '@time_stamp' -o '|' -v '@step_name' --nl "$xmlfile" >> /scratch/rys/view_storage/outroo66.txt end 

This reads 2 xml files in the above mentioned paths and writes the appended content to an output file. Works fine.

I have another text file (exp.txt) which has the above paths in 2 separate lines as shown below:

Test2/ResultReport1.xml Test3/ResultReport2.xml 

The below command works to echo the content of exp.txt line-by-line:

foreach line ( "`cat exp.txt`" ) echo $line end 

Now, I want to use the second statement's output and pass it in the 1st statement for loop (like a sub-query) line-by-line.

I tried this:

foreach xmlfile ( foreach line ( "`cat exp.txt`" ) echo $line; end ) xmlstarlet sel -t -m '//RESULT_STEP' -v '@time_stamp' -o '|' -v '@step_name' --nl "$xmlfile" >>   /scratch/ryerrams/view_storage/outroo66.txt end 

But, this throws the below error:

Missing name for redirect 

Is there any other way I can achieve the above? Please suggest. Thanks.


Category: shell script Time: 2016-07-28 Views: 3

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.127 (s). 12 q(s)