On 05/03/2023 16:50, Jeremie Juste wrote:
#+begin_src awk :in-file test.csv :cmd-line -F ","
{print $0}
#+end_src
Notice that awk has Output Field Separator that is space by default and
may be set using -v OFS=; (or --assign) command line options. -F option
sets input field separator FS variable.
"print $0" just sends input record to output literally. If you try to
modify some field then record is rebuilt taken into account OFS
echo 1,2 | awk -F , '{ $1=$1+10; print; }'
11 2
See (info "(awk) Changing Fields)")
https://www.gnu.org/software/gawk/manual/gawk.html#Changing-Fields
I just have found this link on stackoverflow. It is enough to add even
$1=$1 that should not really modify field values.
So I expect less issues with a more realistic example.
As to ";" as CSV values separator, it often appears with "," as decimal
separator 1234,56 and dd.mm.yyyy date formats. Unfortunately handling of
localized data formats is not a strong side of Emacs. E.g. fixed
LC_NUMERIC=C forces "." as decimal separator, date parsing functions are
rather limited.