bash - How to pass a variable to an awk print parameter -


I am trying to remove nth + 1 and nth + 3 Column from a file.

It does the same effort, which is a useful pseudo code:

  i in {1..100}; ($ I + 3)} $$$$, $$$ 1, \ $ ($ i + 1), $$$ 12, All_Runs.csv & gt; Run- $ i.csv  

which does not clearly work (but it seemed reasonable to expect).

How can I do this?

You can avoid running by using awk to quote some hair and avoid:

/ P>
  Awk -F "," 'BEGIN {i = j = 1} {i ++; J + = 3; Printf "% 3d,% 12.3f,% 12.3f \ n", $ 1, $ i, $ j & gt; Run- $ i.csv} 'All_Runs.csv  

or using the awk's variable-passing feature:

  i in {1..100} } In ; Do awk -f "," -v i = $ i '{i ++; J = i + 2; Printf "% 3d,% 12.3f,% 12.3f \ n", $ 1, $ i, $ j} 'All_Rence CSU & gt; $ I.csv runs; Done  

(both untested)


Comments