Run Sed command inside Awk split(for loop)
<p>Pardon my English, please.</p>

<p>I'm new to shell script and I'm trying to run the sed replace command for each element inside the for loop after split a string using awk</p>

<pre><code># !/bin/sh
SCRIPT_DIR=`pwd`
TEXT_FIELD=$SCRIPT_DIR/Field/textField

FIELDS="code-text name-text"
echo "$FIELD" | awk '{len = split($0,t," ") 
for (i=1; i&lt;=len; i++) {
    "sed -i 's/inputPlaceholder/t[i]/g' $TEXT_FIELD"
} }' 
</code></pre>

<p>When I run it : <code>$ sh code_sample.sh</code>
It's not throw error but not working neither.</p>

<p>Can you help me. I'm most grateful.</p>

<hr>

<p><strong>EDIT</strong></p>

<p>My goal is to read <code>code-text name-text</code> into <code>array[1] = "code-text"</code>, <code>array[2] = "name-text"</code>.</p>

<p>Then the for loop will read one by one and replace each item to the <code>inputPlaceholder</code> string in the given file.</p>

<p>Example:</p>

<p>Input: FILED="code-text name-text"</p>

<p>Output (in the file): text->create("inputPlaceholder") becomes text->create("code-text") and save as code.txt and with the same logic save name-text to name.txt.  </p>