How to print and store specific named columns from csv file with new row numbers

前端 未结 3 900
挽巷
挽巷 2021-01-24 22:40

start by saying, I\'m very new to using bash and any sort of script writing in general.

I have a csv file that has basic column headers and values underneath which look

3条回答
  •  花落未央
    2021-01-24 23:28

    awk 'NR>1 {print i=1+i, $2}' file
    

    NR>1 skips the first line, in your case the header.

    print print following

    i=1+i prints i, i is first 0 and add 1, so i is 1, next time 2 and so on.

    $2 prints the second column.

    file is the path to your file.

提交回复
热议问题