New answers tagged csv
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 '....
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 ...
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 ...
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 ...
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 ...
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(/ /, ...
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&...
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 ...
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 ...
Top 50 recent answers are included
Related Tags
csv × 941awk × 378
text-processing × 371
shell-script × 165
sed × 162
linux × 119
bash × 107
shell × 53
command-line × 46
grep × 40
scripting × 37
text-formatting × 30
files × 28
columns × 27
json × 25
sort × 22
regular-expression × 19
perl × 18
date × 18
jq × 18
array × 15
python × 13
split × 13
join × 12
cut × 11