id name distance
1 3325167 0.334561754018
2 3290488 0.389444269458
3 3288794 0.392312701782
4 3347602 0.392532202097
5 3295355 0.394394169485
I need to add a line after the header line. The first and third field of that added line with both be the value 0 (hard coded). The middle field will be from a bash variable.
what is the meaning of the 1a\ notation? Does that mean to add the line at position 1? I thought you generally needed double quotes to preserve the value of the $VAR.
Here it can work, but it won't in common case because sed and shell metachars can conflict (especially backslashes). So usual practice to embed shell variables in sed command is: