79236062

Date: 2024-11-29 06:49:37
Score: 1
Natty:
Report link

GNU AWK Manual, Splitting by content

Simple test-case:

ID,Fruit,Comment or Description,Cost
1,"Apple",,10.00
2,"Banana",,20.00
3,"Ananas",,40.00
4,"Orange",,8.00
5,"Fruit,with,comma",,100.00
$ awk -v FPAT="([^,]*)|(\"[^\"]+\")" -v OFS=, '{print $2, $4}' f.csv Fruit,Cost
"Apple",10.00
"Banana",20.00
"Ananas",40.00
"Orange",8.00
"Fruit,with,comma",100.00
Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: user3443139