title: How I can sort a text file for specific string?
body: <p>I have a text file with the following lines:</p>
  
  <pre><code> Ca4  0.500001 0.000000 0.000000
   C4   0.750001 0.500000 0.000000
   O10  0.750001 0.243180 0.000000
   O8   0.652432 0.628410 -0.779621
   O12  0.847569 0.628410 0.779621
   Ca3  0.120090 0.500000 -3.035668
   C3   0.370090 0.000000 -3.035668
   O9   0.370090 -0.256820 -3.035668
   O7   0.272522 0.128410 -3.815289
   O11  0.467659 0.128410 -2.256048
   Ca1  0.000000 0.000000 0.000000
   C2   0.250000 0.500000 0.000000
   O4   0.250000 0.756820 0.000000
   O6   0.152432 0.371590 -0.779621
   O2   0.347569 0.371590 0.779621
   Ca2  0.620091 0.500000 -3.035668
   C1   0.870091 0.000000 -3.035668
   O3   0.870091 0.256820 -3.035668
   O5   0.772522 -0.128410 -3.815289
   O1   0.967660 -0.128410 -2.256048
  </code></pre>
  
  <p>What I want to do is simply order the lines so that "Ca" (string) lines go first and the rest of the lines keep as is. </p>
  
  <p>I tried using</p>
  
  <pre><code> grep "Ca" file | sort
  </code></pre>
  
  <p>but it prints only in the screen the lines containing "Ca"</p>
  
  <p>Any suggestions?</p>