title: bash: /bin/ls: Argument list too long
body: <p>I need to make a list of a large number of files (40,000 files) like below:</p>
  
  <pre><code>ERR001268_1_100.fastq  ERR001268_2_156.fastq  ERR001753_2_78.fastq
  ERR001268_1_101.fastq  ERR001268_2_157.fastq  ERR001753_2_79.fastq
  ERR001268_1_102.fastq  ERR001268_2_158.fastq  ERR001753_2_7.fastq
  ERR001268_1_103.fastq  ERR001268_2_159.fastq  ERR001753_2_80.fastq
  </code></pre>
  
  <p>my command is: <code>ls ERR*_1_*.fastq |sed 's/\.fastq//g'|sort -n &gt; masterlist</code>
  However error is: <code>bash: /bin/ls: Argument list too long</code></p>
  
  <p>However can I solve this problem?
  Any other way to make list like this by perl/python?</p>
  
  <p>thx</p>