title: Create a json from given list of filenames in unix script
body: <p>Hello I am trying to write unix script/command where I have to list out all filenames from given directory with filename format string-{number}.txt(eg: filename-1.txt,filename-2.txt) from which I have to form a json object. any pointers would be helpful.</p>
  <pre><code> [{
          &quot;filenumber&quot;: &quot;1&quot;,
          &quot;name&quot;: &quot;filename-1.txt&quot;
      },
      {
          &quot;filenumber&quot;: &quot;2&quot;,
          &quot;name&quot;: &quot;filename-2.txt&quot;
      }
   ]
  </code></pre>
  <p>In the above json file-number should be read from {number} format of the each filename</p>