Adding a variable to a column in Linux
Hello everyone,
I'm trying to add a predefined variable to a column in a text file in Linux. For example:
Any help or suggestions would be greatly appreciated!
geodave
I'm trying to add a predefined variable to a column in a text file in Linux. For example:
awk '{ print $1+2.50 }' file1.txt > file2.txt
works fine if I hard code the number 2.50 in the awk program. How would I go about making the 2.50 value a variable that I can predefine before the awk statement in a shell script?Any help or suggestions would be greatly appreciated!
geodave
0
Comments
DERP=2.50 awk '{ print $1+$DERP }' file1.txt > file2.txtI assume you're doing this in a shell script?
geodave