From: Max Nikulin <manikulin@gmail.com>
To: Jeremie Juste <jeremiejuste@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: [FR] ob-awk.el specifying a delimeter argument in for output
Date: Mon, 6 Mar 2023 17:00:54 +0700 [thread overview]
Message-ID: <cf8b1436-6ff5-9e9e-25ca-ef1dff505a07@gmail.com> (raw)
In-Reply-To: <87ttyzcyrp.fsf@gmail.com>
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.
prev parent reply other threads:[~2023-03-06 10:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-05 9:50 [FR] ob-awk.el specifying a delimeter argument in for output Jeremie Juste
2023-03-05 12:37 ` Ihor Radchenko
2023-03-06 7:36 ` Jeremie Juste
2023-03-06 7:47 ` Jeremie Juste
2023-03-06 10:00 ` Max Nikulin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cf8b1436-6ff5-9e9e-25ca-ef1dff505a07@gmail.com \
--to=manikulin@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=jeremiejuste@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).