All of these are being written in case : Case 1: echo ${name}:${identity}:${hp}:$now:0 >> info.txt      # write to info.txtso i will have something like this : Tom:8:987654:commission:0  # i assign it to 0 firstCase 2 : echo -n Enter employee's name:read nameS=`grep $name info.txt`;        if test -z $S thenecho No details with employee name  $nameelseecho $S | cut -d: -f4 // display 4th column.echo echo -n Enter hourly wage: ; read wage;echo -n Enter hours worked this week: ; read hours;pay=$hours-40*$wage;          echo -n To update next payroll : press Y else N to go main menu:      read optioncase $option in [Yy]*)  echo Payroll have been updated.    echo grep $name | sed -i s/\:*$/$pay/n info.txt //error             ;;[Nn]*)     echo Press Enter to view the Main     esacfiMy textfile looks like this:Tom:8:987654:commission:0Tommy:7:12379813:hourly:0Fan:5:2132131:salaried:0I am trying to replace the last column value to $pay ( not all columns only the specific name by the user ) Lets say the $pay is 10 and $name is TommyThis is the expected textfile:   Tom:8:987654:commission:0    Tommy:7:12379813:hourly:10    Fan:5:2132131:salaried:0But i got this error : sed: -e expression #1, char 15: unknown option tos'`i am doing in on ubuntu terminal .
ubuntu linux shell scripting changing a column value of a line in textfile
linux;shell script;ubuntu;sed
Replace the whole line:sed -e /$name/s/[0-9]*$/$pay/ -i info.txt