title: Linux - Bash Redirect a String to a file
body: <p>I wrote a simple script that  is reading the file content and incrementing a a number inside this file, then i'm holding the change using awk, when i'm trying ro redirect the new String using '>' the whole string is redirected in one line and not like the original was which is 4 lines.</p>
  
  <pre><code>#!/bin/bash -x
  
  # This script is for Incrementing build numbers
  
  path=/home/RND/abrodov
  file=tst.txt
  tst=`cat $path/$file`
  printf "this is the content of the file before incrementing: \n $tst"
  newexpr=`awk '/^Build Number/{$4=$4+1;}1' /home/RND/abrodov/tst.txt`
  printf "\n the new content \n $newexpr"
  echo $newexpr &gt; $path/$file
  </code></pre>
  
  <p>This is the original file before running the script:</p>
  
  <pre><code>Major Release Number = 4
  Minor Release Number = 1
  Service Pack Release Number = 2
  Build Number = 22
  </code></pre>
  
  <p>This is the content after i used the script:</p>
  
  <pre><code>Major Release Number = 4 Minor Release Number = 1 Service Pack Release Number = 2 Build Number = 23
  </code></pre>
  
  <p>I'm trying to figure out how can i redirect the text in the original format which is 4 lines.</p>