awk: Make the historic -Ft to signify field separator as tab optional
The historic behavior of awk has been to make -Ft mean -F\t. However, that's a bit of a wart and antiquated. Make this behavior optional based on a simple ifdef HISTORIC_FT_WART.
I'll think about it. I don't like hiding this wart, it has been there for a very long time, there could be scripts that depend on this.
Given my recent experience with subtle changes causing weird breakage, I'm inclined to withdraw this request since -Ft has been a thing for so long.
I will note that POSIX doesn't require this wart, and gawk only implements it with the --traditional option. I suspect it's actually a safe change. Or you might could condition it on POSIXLY_CORRECT, but that's a bit of a slippery slope.
POSIXLY_CORRECT which POSIX?
Though it would make that other change go from a #if 0 to a #if POSIXLY_CORRECT >= 2001 && POSIXLY_CORRECT <= 2004 :) Though the later standards author clearly felt that would be more of a POSIX_MISTAKE
So while I may poke a little fun in this comment, I think that would be quite the slippery slope...
That wasn't what I meant (checking POSIX at compile time). Rather, gawk pays attention to the POSIXLY_CORRECT environment variable, and if it's there, turns on the --posix option. There is one place in the OTA where this is done as well.
In this case though, POSIXLY_CORRECT doesn't really help, since POSIX doesn't require -Ft to mean FS = "\t".
Oz, IMHO it's safe to simply make the change and be done, but I'll leave it up to you. (Or you can ping BWK privately.)
I found an unfortunate number cases of awk -Ft in github and elsewhere. that wart is better known than I thought.
For the record, how many? And how did you find them :)
github code search alone finds 241 hits, [sans about a third to half of those that are "-FT".] some of our own solaris scripts have a handful of instances. didn't search other code hosting sites (not sure which ones have good code search). saw some in stackoverflow etc as well.
anyway, i suppose it is time to deprecate the t-wart.
I found an unfortunate number cases of awk -Ft in github and elsewhere. that wart is better known than I thought.
I really find this surprising. In > 30 years nobody has ever complained to me about gawk not supporting this wart. In any case, I agree that deprecating it is a good idea.
FWIW, -Ft is no longer documented in the upcoming 2nd edition of the original awk book. I suggest leaving the code alone, since apparently people still expect it to work, but leaving it undocumented. Maybe we can close this PR?