title: Right Align Columns in Text File with Sed
body: <p>I have a file containing a lot of information that I want to get in a specific format, i.e. add a specific number of spaces between the different columns. I can add the same amount of spaces to every line, but some of the columns need to be right aligned, meaning that I might need to add more spaces in some lines. I have no idea how to do this, and awk doesn't seem to work since I have more than two lines modify.</p>
  
  <p>Here's an example:</p>
  
  <p>I have managed to get a file looking something like this</p>
  
  <pre><code>apple   1   33.413 C     cat    10
  banana   2   21.564 B     horse    356
  cherry   3   43.223 D     cow    32
  pear   4   26.432 A     goat    22
  raspberry   5   72.639 C     eagle    4
  watermelon   6   54.436 A     fox    976
  pumpkin   7   42.654 B     mouse    1
  peanut   8   36.451 B     dog    56
  orange   9   57.333 C     elephant    32
  coconut   10   10.445 A     frog    3
  blueberry   11   46.435 B     camel    446
  </code></pre>
  
  <p>But I want to get the file on this format</p>
  
  <pre><code>apple         1   33.413 C          cat    10
  banana        2   21.564 B        horse    356
  cherry        3   43.223 D          cow    32
  pear          4   26.432 A         goat    22
  raspberry     5   72.639 C        eagle    4
  watermelon    6   54.436 A          fox    976
  pumpkin       7   42.654 B        mouse    1
  peanut        8   36.451 B          dog    56
  orange        9   57.333 C     elephant    32
  coconut      10   10.445 A         frog    3
  blueberry    11   46.435 B        camel    446 
  </code></pre>
  
  <p>What bash command can I use to right align the second and fifth columns?</p>