How to Add Column with Percentage

前端 未结 4 1649
半阙折子戏
半阙折子戏 2021-02-08 09:53

I would like to calculate percentage of value in each line out of all lines and add it as another column. Input (delimiter is \\t):

1   10      
2   10
3   20
4          


        
4条回答
  •  迷失自我
    2021-02-08 10:36

    You need to escape it as %%. For instance:

    printf("%s\t%s\t%s%%\n", $1, $2, $3)
    

提交回复
热议问题