title: How to write a shell script to swap columns in txt file?
body: <p>I was trying to solve one of my old assignment I am literally stuck in this one Can anyone help me?</p>
  <p>There is a file called &quot;datafile&quot;. This file has names of some friends and their</p>
  <p>ages. But unfortunately, the names are not in the correct format. They should be</p>
  <p>lastname, firstname</p>
  <p>But, by mistake they are  firstname,lastname</p>
  <p>The task of the problem is  writing a shell script called fix_datafile</p>
  <p>to correct the problem, and sort the names alphabetically. The corrected filename</p>
  <p>is called datafile.fix .</p>
  <p>Please make sure the original structure of the file should be kept untouched.</p>
  <p>The following is the sample of datafile.fix file:</p>
  <p>#<strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong>personal information</strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></p>
  <h1></h1>
  <p>#******** Name *********     ***** age *****</p>
  <h1></h1>
  <p>Alexanderovich,Franklin        47</p>
  <p>Amber,Christine            54</p>
  <p>Applesum,Franky            33</p>
  <p>Attaboal,Arman             18</p>
  <p>Balad,George              38</p>
  <p>Balad,Sam               19</p>
  <p>Balsamic,Shery             22</p>
  <p>Bojack,Steven             33</p>
  <p>Chantell,Alex             60</p>
  <p>Doyle,Jefry              45</p>
  <p>Farland,Pamela             40</p>
  <p>Handerman,jimmy            23</p>
  <p>Kashman,Jenifer            25</p>
  <p>Kasting,Ellen             33</p>
  <p>Lorux,Allen              29</p>
  <p>Mathis,Johny              26</p>
  <p>Maxter,Jefry              31</p>
  <p>Newton,Gerisha             40</p>
  <p>Osama,Franklin             33</p>
  <p>Osana,Gabriel             61</p>
  <p>Oxnard,George             20</p>
  <p>Palomar,Frank             24</p>
  <p>Plomer,Susan              29</p>
  <p>Poolank,John              31</p>
  <p>Rochester,Benjami           40</p>
  <p>Stanock,Verona             38</p>
  <p>Tenesik,Gabriel            29</p>
  <p>Whelsh,Elsa              21</p>