Re:Modernizing AWK, a 45-year old language, by adding CSV su...
by WFHRenaissance on Thursday May 12, 2022 @02:38PM
(#31358347)
Always had CSV support, it's called `awk --field-separator=","`.
[ Parent
| on HN ]
Re:Modernizing AWK, a 45-year old language, by adding CSV su...
by gshubert17 on Thursday May 12, 2022 @02:47PM
(#31358487)
I think the article already showed that with the example -F,
The problem is commas inside quoted strings, as in the example "Smith, Bob".
I believe the field-separator option on awk will break the quoted string at the interior comma.
Re:Modernizing AWK, a 45-year old language, by adding CSV su...
by asdff on Thursday May 12, 2022 @03:06PM
(#31358786)
You could just replace those commas within the quote with some other string or remove them if you wanted with some awk or sed. Here is a somewhat relevant example from stackoverflow:
awk -F'"' -v OFS='' '{ for (i=2; i<=NF; i+=2) gsub(",", "", $i) } 1' infile
1. https://unix.stackexchange.com/questions/48672/remove-comma-...
Re:Modernizing AWK, a 45-year old language, by adding CSV su...
by WFHRenaissance on Thursday May 12, 2022 @03:42PM
(#31359291)
LOL - you guys actually read the articles?
Re:Modernizing AWK, a 45-year old language, by adding CSV su...
by __jem on Thursday May 12, 2022 @02:40PM
(#31358376)
I see you like to live dangerously.
Re:Modernizing AWK, a 45-year old language, by adding CSV su...
by WFHRenaissance on Thursday May 12, 2022 @03:41PM
(#31359286)
AWK is my hammer and I will abuse it to every end