Skip to main content

Questions tagged [csvkit]

0 votes
5 answers
1k views

command-line tool to sum the values in a column of a CSV file

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 ...
halloleo's user avatar
  • 659
7 votes
2 answers
528 views

Deduplicate CSV rows based on a specific column, with a CSV parser

I searched for this task, and found the following older questions: Removing Duplicates from a CSV based on specified columns Identify unique records on CSV based on specific columns But I can't use ...
Mévatlavé Kraspek's user avatar
6 votes
3 answers
528 views

Truncate an CSV column using CsvKit

How can I truncate the length of a column using CSVKit? The definition looks like this: Column 1: no length restriction Column 2: <no more than 2 characters> This should properly handle ...
patstuart's user avatar
  • 163
3 votes
2 answers
4k views

how to install csvkit in bash

Kusalananda nicely recommends using csvformat from csvkit to format jq @csv into a csv format without double quotes " answering how to parse json with jq. This answer does not seem to involve the ...
Johan's user avatar
  • 439
1 vote
1 answer
174 views

How can I separate these two columns in this csv file in Linux/Bash?

I am looking to separate these two columns, each into their own separate text files. This data is from a csv file on Kaggle that contains Titanic passenger data. The first column is the number of ...
Tyler Young's user avatar
0 votes
1 answer
145 views

Syntactical error with csvsql query?

I have a csv file attributes.csv from which I want to retrieve all records to a new file attributes_withoutPIDate.csv excluding records for which the Name column has "PI Date" as the value. ...
ptrcao's user avatar
  • 6,015
0 votes
2 answers
2k views

Concatenating columns of the same csv file to create a new column with a new heading

What I have is a CSV file to this effect: +------------+--------------+ | Category I | Sub-Category | +------------+--------------+ | 1144 | 128 | | 1144 | 128 | | ...
ptrcao's user avatar
  • 6,015
0 votes
1 answer
1k views

How to write a csvcut script to cut column by header with multiple files?

Since csvcut (from csvkit) does not take more than a single file at a time, I need to write a script to process multiple files using it. The first parameter should be the delimiter, the second ...
amV's user avatar
  • 85
0 votes
2 answers
1k views

CSV fields max length error and setting quoting=csv.QUOTE_NONE

After running csvcut on a comma-delimited .csv file: [root@server files]# csvcut -c title,mpn,overview,techspecs2,image_carousel_elargesrc syn_multi-image.csv > syn_scraped_cut.csv I get the error:...
ptrcao's user avatar
  • 6,015