title: how to convert .txt file output in to table format in shell script / bash [not in html table format]
body: <p>I want to convert a text file into the MySQL type proper table format in the bash script.</p>
  <p>for now, I'm dumping output in one text file [table.txt] then read line by line to print in formated order.</p>
  <p>also want to print the location of file [toatl path]</p>
  <p>but I want a better solution.</p>
  <pre><code>#!/bin/bash
  search_dir=&quot;$1&quot;
  
  path=$(ls -l $search_dir)
  
  echo &quot;$path&quot; | awk -v OFS='\t''|''\t' 'BEGIN{print &quot;          Owner         |      Size     |        Name     &quot;}; {print&quot;|&quot; $3,  $5, $9 &quot;\t&quot;&quot;|&quot;}' &gt; table.txt
      
  
  while IFS= read -r line; do
      echo &quot;$line&quot;
      echo &quot;-----------------------------------------------------------------&quot;
  done &lt; table.txt
  </code></pre>
  <p><a href="https://i.stack.imgur.com/b5kal.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b5kal.png" alt="Required output something like this" /></a></p>