Skip to main content

New answers tagged

0 votes

Is there a robust command line tool for processing csv files?

This is a fix for Alpaca's earlier answer which was on the right track, but didn't actually work. $ printf 'c0,c1,c2\n"this, is the first entry", this is the second, 34.5' | sqlite3 -cmd '....
Derek Mahar's user avatar
0 votes

Is there a robust command line tool for processing csv files?

DuckDB can query CSV files directly, including from standard input on Unix like operating systems: $ echo '"this, is the first entry", this is the second, 34.5' | duckdb -c 'SELECT * FROM ...
Derek Mahar's user avatar
0 votes

Is there a robust command line tool for processing csv files?

csvtk can read and process CSV files and csvtk cut in particular can select specific columns from an input CSV file: $ echo '"this, is the first entry", this is the second, 34.5' | csvtk ...
Derek Mahar's user avatar
1 vote

Large file manipulation

duckdb cli is a great tool to run this kind of task for large file. If the input file is in example this TSV Postcode Latitude Longitude Lorem Ipsum AB1 0AA 57.101474 -2.242851 e 2 AB1 ...
aborruso's user avatar
  • 2,915
1 vote

Large file manipulation

This might work for your Ubuntu box: gawk -v OFS=, '{print $2,$3,q $1 q}NR==1{FS=","; q="\""}' pc0.csv The idea is to reset FS="," and specify the quotes after the ...
lihao's user avatar
  • 121
4 votes

Large file manipulation

This, using any awk, will convert the first sample file you show to the second sample file you show: $ awk ' BEGIN { FS=OFS="," } { sub(/ +$/, "") } NR == 1 { gsub(/ /, ...
Ed Morton's user avatar
  • 33.1k
0 votes

How to remove comma from a csv file with quotes?

Using Raku (formerly known as Perl_6) ~$ raku -MText::CSV -e 'my @a = csv(in => $*IN, sep => ", "); for ^@a[0].elems -> $i { @a&...
jubilatious1's user avatar
  • 3,505
0 votes

Find duplicated column value in CSV

Using Miller (mlr) to read the data as headerless CSV, adding a count to each record, signifying the number of times the first field occurs in the input, then filtering out (extracting) all records ...
Kusalananda's user avatar
  • 342k
0 votes

Find duplicated column value in CSV

Using Raku (formerly known as Perl_6) Raku is a Perl-family programming language, with a small (but growing) module ecosystem. This problem might be tackled with a CSV parser such as Raku's Text::CSV ...
jubilatious1's user avatar
  • 3,505

Top 50 recent answers are included