wireservice / csvkit

A suite of utilities for converting to and working with CSV, the king of tabular file formats.
https://csvkit.readthedocs.io
MIT License
6.03k stars 603 forks source link

combining 2 columns in csv #1176

Closed slackmoehrle closed 2 years ago

slackmoehrle commented 2 years ago

I have data:

07/01/2022, 10:00, 1.00, 2.00, 1.00, 2.00, 5000 07/01/2022, 10:01, 1.25, 2.00, 0.99, 2.00, 3000

and I want to end up with:

07/01/2022 10:00, 07/01/2022, 10:00, 1.00, 2.00, 1.00, 2.00, 5000 07/01/2022 10:01, 07/01/2022, 10:01, 1.25, 2.00, 0.99, 2.00, 3000

which is concatenating fields 1 and 2 and then outputting all data to a csv.

How can this be done?

In awk I could do something like this: awk -F',' 'NF {print $1"-"$2","$0}'

jpmckinney commented 2 years ago

We don't have that option but maybe https://github.com/jqnatividad/qsv or https://github.com/BurntSushi/xsv can do it.