command-line tool to sum the values in a column of a CSV file
0
votes
5
answers
1060
views
I am looking for a command-line tool to calculate the sum of the values in a specified column of a CSV file. (**Update**: The CSV file might have quoted fields, so a simple solution just to break on a delimiter (',') does not work.)
Given the following sample CSV file:
description A,description B,data 1, data 2
fruit,"banana,apple",3,17
veggie,cauliflower,7,18
animal,"fish,meat",9,22
I want to build the sum, for example, over the column data 1
with the result **19**.
I have tried to use [csvkit] for this but didn't get very far. Are there other command-lien tools specialised in this CSV operation?
Asked by halloleo
(649 rep)
Jul 2, 2024, 01:41 AM
Last activity: Apr 23, 2025, 03:04 PM
Last activity: Apr 23, 2025, 03:04 PM