title: Regex Date and Time Delimitter and Sort
body: <p>My logs are getting stored in multiple Sun based unix servers.</p>
  <p>So logs of Req1 might be in server1, Req2 and Req3 might be in server2 and then Req4 could be in server1 again. There is no proper sequence as it is stored based on what load balancer decides.</p>
  <p>We use grep to get the data from all the servers. But problem is they are not sorted based on the time. What I want is to get the log file from all the servers as below but sort it based on the date and time.</p>
  <p><strong>Edit</strong>
  Here is example for the question.</p>
  <pre><code>for (( i=1; i&lt;=24; i++ )) do
      echo 'server1' $logfile $i 
      grep abd12453 /var/logs/$i.log
      echo 'server2' $logfile $i
      ssh server2 &quot;grep 'abd12453' /var/logs/$i.log&quot;
  done
  </code></pre>
  <p>where abd12453 is the user based on which the log will be extracted.</p>
  <p>The above commands combines logs of all files of both server and print it. like below.</p>
  <pre><code>server1 logfile1.log
  06/13/2020 13:26:11.142 abd12453 server 1 log data1. server 1 log data1. server 1 log data1. server 1 log data1. server 1 log data1. server 1 log data1. server 1 log data1. server 1 log data1. server 1 log data1. server 1 log data1. server 1 log
  
  server2 logfile1.log
  06/13/2020 13:25:23.250 abd12453 server 2 log data1. server 2 log data1. server 2 log data1. server 2 log data1. server 2 log data1. server 2 log data1. server 2 log data1. server 2 log data1. server 2 log data1. server 2 log data1. server 2 log 
              
  server1 logfile2.log
  06/13/2020 13:15:35.142 abd12453 server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2.
      
  server2 logfile2.log  
  06/13/2020 13:14:42.156 abd12453 server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log 
  </code></pre>
  <p>The above logs are all single lines along with username.</p>
  <p>I need to sort the log data above based on date and time.</p>
  <p>Required output should be</p>
  <pre><code> server2 logfile2.log  
      06/13/2020 13:14:42.156 abd12453 server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log 
  
     server1 logfile2.log
      06/13/2020 13:15:35.142 abd12453 server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2. server 1 log data2.
      
    server2 logfile1.log
      06/13/2020 13:25:23.250 abd12453 server 2 log data1. server 2 log data1. server 2 log data1. server 2 log data1. server 2 log data1. server 2 log data1. server 2 log data1. server 2 log data1. server 2 log data1. server 2 log data1. server 2 log 
  
  server1 logfile1.log
      06/13/2020 13:26:11.142 abd12453 server 1 log data1. server 1 log data1. server 1 log data1. server 1 log data1. server 1 log data1. server 1 log data1. server 1 log data1. server 1 log data1. server 1 log data1. server 1 log data1. server 1 log
  </code></pre>