Search Results

Search found 1 results on 1 pages for 'user3502786'.

Page 1/1 | 1 

  • Linux - Bash Redirect a String to a file

    - by user3502786
    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. #!/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 > $path/$file This is the original file before running the script: Major Release Number = 4 Minor Release Number = 1 Service Pack Release Number = 2 Build Number = 22 This is the content after i used the script: Major Release Number = 4 Minor Release Number = 1 Service Pack Release Number = 2 Build Number = 23 I'm trying to figure out how can i redirect the text in the original format which is 4 lines.

    Read the article

1