I am trying to make this command:
sed bla bla filename | awk '{printf "%s %s_entry_%.3f %.3f %.3f %.3f",$1,$3,$4,$5,$6,$7}'
But the fact is, I want the% .3f part to be variable. Thus, in one case it can be% .3f, and in another -%. 3f% .3f% .3f. Therefore, I just use static code in my code example for clarity. Therefore, if I want 4 of these% .3f and put them in $ variable variables like this:
values="%.3f %.3f %.3f %.3f"
Then how can I put this line in an awk expression without making awk just put literally "$ {values}" there. The following is my non-working attempt:
sed bla bla filename | awk '{printf "%s %s_entry_${values}",$1,$3,$4,$5,$6,$7}'
source
share