Linked Questions
18 questions linked to/from Is there a robust command line tool for processing CSV files?
4
votes
6
answers
25k
views
Handling comma in string values in a CSV file [duplicate]
I have a comma-separated file which has numeric and string columns. String columns are quoted and can have comma in between the quotes. How do I identify the columns with FS =","?
Sample records
"...
3
votes
1
answer
12k
views
Any good csv bash utility? [duplicate]
I'm currently working with some CSV datasets and was wondering whether there are any good (even better if standard) CLI ways of manipulating CSV data.
To be more precise, I mainly want to be able to:
...
4
votes
2
answers
4k
views
Can you specify an enclosure for cut? [duplicate]
Possible Duplicate:
Is there a robust command line tool for processing csv files?
I can use cut to extract columns from a file:
$ cat foo
foo,bar,hello
bash,baz,world
$ cut -d\, -f2 foo
bar
baz
...
0
votes
3
answers
2k
views
Is there a way to accurately parse a true CSV file? [duplicate]
I'm using bash shell. I want to parse a CSV file, in which the CSV file observes true CSV formats. From this thread -- https://stackoverflow.com/questions/4286469/how-to-parse-a-csv-file-in-bash , I ...
3
votes
1
answer
1k
views
Parse csv using awk [duplicate]
Possible Duplicate:
Is there a robust command line tool for processing csv files?
I am trying to parse the second line in a file (which contains commas within double quotes)
"100 Watt A19 10,000 ...
1
vote
2
answers
2k
views
Extract given column from comma-separated values with inner commas and quotation marks [duplicate]
I have a file in which the fields are separated by comma.
Some example input:
col1,"1,2",col3
col1,"1,2,3",col3
col1,"1 2,3",col3
col1,"1 "2,3"",col3
Now, I have to fetch the second column, so that ...
43
votes
5
answers
61k
views
Is there a command line spell to drop a column in a CSV-file?
Having a file of the following contents:
1111,2222,3333,4444
aaaa,bbbb,cccc,dddd
I seek to get a file equal to the original but lacking a n-th column like, for n = 2 (or may it be 3)
1111,2222,4444
...
28
votes
5
answers
82k
views
How to manipulate a CSV file with sed or awk?
How can I do the following to a CSV file using sed or awk?
Delete a column
Duplicate a column
Move a column
I have a big table with over 200 rows, and I'm not that familiar with sed.
9
votes
3
answers
9k
views
Using CSV line as command parameters
I have a CSV file like:
Name,Age,Address
Daniel Dvorkin,28,Some Address St. 1234
(... N ...)
Foo Bar,90,Other Address Av. 3210
And I have a command that take this parameters:
./mycommand --name="...
4
votes
3
answers
39k
views
How to iterate through a comma-separated list and execute a command for each entry
I have been give a command which outputs a comma-separated list for autosys jobs in the variable $all_jobs:
box=box-of-jobs;all_jobs=$(jobscout -box $box | egrep "^\w+" | tr '\n' ',' | sed s/.$//);
...
10
votes
1
answer
3k
views
How can SQLite command ".import" read directly from standard input?
How would you modify function csv_to_sqlite so that sqlite3 command .import reads directly from standard input instead of from a temporary named pipe?
#!/bin/bash
function csv_to_sqlite() {
local ...
2
votes
3
answers
2k
views
Extract (and dump to stdout) only certain range of rows from a CSV?
I have a CSV file of approx 1000 rows, and where I'm supposed to import it, I get an error on row 700. However, the entries in this CSV contain newlines (and are quoted), and thus I cannot really ...
1
vote
3
answers
2k
views
sort CSV by number of column in rows?
I have multiple CSV files with many records. The total number of rows should be 134. I have many files, and each rows has its own number of columns (from 15 to 200). I need to sort them according to ...
1
vote
2
answers
2k
views
AWK Command - Edit Blank "Cell" in CSV to Text Value
I am sorry if my question is more a typographical error, but I have been trying to sort this out for a while now and sadly, I cannot get this to work. Perhaps I should use the sed command, but I haven'...
0
votes
1
answer
615
views
Parse comma separated string ignoring commas between quotes
I have a comma separated string that could contain quoted elements with commas. For example:
issuer=C = US, O = "DigiCert, Inc.", CN = DigiCert High Assurance TLS Hybrid ECC SHA256 2020 CA1
...