title: Random numbers generation with awk in BASH shell
body: <p>I wish to shuffle the lines (the rows) of a file at random then print out to different five files.</p>
  
  <p>But I keep having exactly the same order of lines appeared in file1 to file5. The random generation process does not work properly. I would be grateful for any advices. </p>
  
  <pre><code>#!/bin/bash
  for i in seq 1 5
  do
    awk 'BEGIN{srand();}  {print rand()"\t"$0}' shuffling.txt  | sort -k2 -k1 -n | cut -f2-  &gt; file$i.txt
  done
  </code></pre>
  
  <p>Input shuffling.txt</p>
  
  <pre><code>111 1032192
  111 2323476
  111 1698881
  111 2451712
  111 2013780
  111  888105
  112 2331004
  112 1886376
  112 1189765
  112 1877267
  112 1772972
  112  574631
  </code></pre>