Timeline for command-line tool to sum the values in a column of a CSV file
Current License: CC BY-SA 4.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 16, 2024 at 1:37 | comment | added | dave_thompson_085 | Instead of !~ /data/ I would just check NR>1 -- by convention the header is only one line and first. Or you can get away with no check, because a nonnumeric field is treated as zero in arithmetic. | |
| Jul 2, 2024 at 4:37 | comment | added | user1683793 | @halloleo, I believe you will find this updated version satisfactory. I had not dealt with quoted strings in awk before. Interesting. | |
| Jul 2, 2024 at 4:35 | history | edited | user1683793 | CC BY-SA 4.0 | Added second solution to take care of quoted strings. |
| Jul 2, 2024 at 4:00 | comment | added | halloleo | Thanks for the answer. My question was not detailed enough: I missed saying that the CSV file might have quoted fields. Sorry for this, @user1683793. - I updated the question (incl sample CSV) to make that clear. | |
| Jul 2, 2024 at 2:16 | history | answered | user1683793 | CC BY-SA 4.0 |