I have ASCII file contain numbers as follow:1 2 35 6 97 8 9 . . . . . . . . . . . . . . .  etcI want to upgrade this file by multiplying each value by 3 to get :3 6 915 18 2721 24 27 . . . . . . . . . . . . . . .  etcI want these changes to be updated and saved automatically in the same ASCII file after running the script How can I accomplish this using standard GNU utilities? I can update the values by doing:while IFS=,$IFS read d1 d2 d3; do echo $(( $d1*3 )) $(( $d2*3 )) $(( $d3*3 )) done < file.txt #file.txt is the previous ASCII file
Multiplying numbers in-place in a file
shell;text processing;files;awk
This way you can save new values to file:awk -F   '{$1*=3;$2*=3;$3*=3;print}' FILE | tee FILE