Timeline for print specific column with specific output field separator
Current License: CC BY-SA 4.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 26, 2021 at 22:01 | comment | added | Ed Morton |
Some people refer to the whole <condition> { <action> } statement as a "rule" (we just saw such a reference on the bug-gawk mailing list IIRC), but for me "rule", like "pattern", is kinda vague and needs to be defined in any given context. You can't go wrong with saying <condition> { <action> } - that is 100% accurate and unambiguous.
|
|
| Jul 26, 2021 at 21:59 | comment | added | steeldriver |
@EdMorton I used to be in the habit of referring to them as rule {action} but I seem to remember I was "corrected" on that ...
|
|
| Jul 26, 2021 at 21:58 | comment | added | Ed Morton |
@Porcupine no, awk '{print $2, $3}' FS="," OFS="," A.tsv is similar to awk -F ',' -v OFS="," '{print $2, $3}' A.tsv but it's not equivalent. They are different in when the assignments take effect (in BEGIN for -v, after it for arg list), and whether or not escape sequences get translated (they do for -v, they don't for arg list) and whether or not they are stored in ARGV and impact ARGC (they do not for -v, they do for arg list).
|
|
| Jul 26, 2021 at 21:50 | comment | added | Ed Morton |
I know all the AWK documentation says "pattern" but it's all wrong. Awk is made up of <condition> { <action> } statements, not <pattern> { <action> } statements. The latter made some sense in the very first awk version which really only did pattern matching but is woefully misleading and outdated for any awk version since the 1980s. In what way is foo == 17 a pattern? It's not, it's a condition. In what way is TRUE a pattern? It's not, it's a condition. When we write if (X) <action> in C, we don't say X is a pattern, it's a condition. And so on...
|
|
| Jul 26, 2021 at 17:48 | vote | accept | Porcupine | ||
| Jul 26, 2021 at 8:05 | comment | added | AdminBee |
Or awk 'BEGIN{FS=OFS=","} ... '.
|
|
| Jul 26, 2021 at 2:04 | comment | added | Porcupine |
Is it equivalent to awk -F ',' -v OFS="," '{print $2, $3}' A.tsv
|
|
| Jul 26, 2021 at 1:18 | history | edited | steeldriver | CC BY-SA 4.0 |
added 5 characters in body
|
| Jul 25, 2021 at 23:24 | history | edited | steeldriver | CC BY-SA 4.0 |
added 284 characters in body
|
| Jul 25, 2021 at 22:34 | history | edited | steeldriver | CC BY-SA 4.0 |
deleted 34 characters in body
|
| Jul 25, 2021 at 21:47 | history | edited | steeldriver | CC BY-SA 4.0 |
added 231 characters in body
|
| Jul 25, 2021 at 21:41 | history | answered | steeldriver | CC BY-SA 4.0 |