bug-datamash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Fixed incomplete and incorrect treatment of comments and tra


From: Tim Rice
Subject: Re: [PATCH] Fixed incomplete and incorrect treatment of comments and trailing whitespace
Date: Fri, 27 May 2022 22:22:40 +0000

Hi Dima,

I haven't tested this yet, but that wasn't my intent. Comments should do
what they do in perl and python and awk and everywhere else, so the last
line should be interpreted as "1,2". I may have made a mistake in the
implementation.

It's not a good analogy, because datamash isn't a programming language, and the 
data it consumes does not have a programmatical grammar.

A more correct analogy is to consider how Awk handles comments *in the data 
consumed by Awk*, not within Awk scripts.

You can see what I mean if you do this:

```
$ echo '1,2#This is a comment#,3' | awk -F, '{print $2}'
2#This is a comment#
```

So we see, even though the hash symbol is used as a comment in Awk, Awk does 
not strip it from input data.

I agree with what Shawn said: stripping comments in general is not in the remit 
of Datamash. It wasn't really a good idea to permit whole-line comments in the 
first place, since this can easily be handled by sed. It's only regretful that 
we can't really roll back the over-reach now.

Still, even though we can't roll it back, at least we shan't compound the 
misstep by making comments even more complicated.

~ Tim



reply via email to

[Prev in Thread] Current Thread [Next in Thread]