How can I feed this long line of arguments to an executable?
<p><strong>Arguments file</strong></p>

<p>On <code>args.txt</code>, there are long series of arguments for different call of an executable. Each line contain the arguments for a single call of the executable. One line of <code>args.txt</code> looks like</p>

<pre><code>2 1 -A 7 -B true -C 0.0035 -D /path/to/somewhere ....
</code></pre>

<p>The line start by <code>2 1</code> as the first two arguments to be given to the executable are "unnamed" (do not come with a flag).</p>

<p><strong>First try</strong></p>

<p>I first tried</p>

<pre><code>i=5
./myexec `sed "${i}q;d" args.txt`
</code></pre>

<p>it works most of the time. However, for some lines, the arguments are too long and I receive <code>Error: Command Line Too long</code> as I am overpassing <code>getconf ARG_MAX</code>. Note the software does not allow for specifying arguments other than through the command line.</p>

<p><strong>Second try</strong></p>

<p>So I tried</p>

<pre><code>sed "${i}q;d" args.txt | xargs ./myexec
</code></pre>

<p>This second try causes the executable to return nothing.</p>

<p><strong>Questions</strong></p>

<ul>
<li>Am I doing something wrong with <code>sed "${i}q;d" args.txt | xargs ./myexec</code>?</li>
<li>Once I fix the second try, will I encounter the same issue (<code>Command Line Too long</code>) as for the first try?</li>
<li>Could there be a quotation issue which causes <code>./myexec</code> to consider the long string as a single argument or something similar?</li>
<li>Would you suggest me trying another way of feeding the arguments to <code>myexec</code>?</li>
</ul>

<p><strong>FYI</strong></p>

<p>I am on <code>Mac OS X 10.11.3</code> with <code>Terminal 2.6.1</code></p>