Groups | Search | Server Info | Login | Register
Groups > alt.comp.lang.awk > #20
| From | Janis Papanagnou <janis_papanagnou+ng@hotmail.com> |
|---|---|
| Newsgroups | alt.comp.lang.awk, comp.lang.awk |
| Subject | Re: printing words without newlines? |
| Date | 2024-05-16 15:55 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <v2538p$1jmvm$1@dont-email.me> (permalink) |
| References | <v1pi7c$2b87j$1@dont-email.me> <v250m9$1j3gp$1@dont-email.me> |
Cross-posted to 2 groups.
On 16.05.2024 15:11, Ed Morton wrote:
> On 5/11/2024 11:57 PM, David Chmelik wrote:
>> I'm learning more AWK basics and wrote function to read file, sort,
>> print. I use GNU AWK (gawk) and its sort but printing is harder to get
>> working than anything... separate lines work, but when I use printf() or
>> set ORS then use print (for words one line) all awk outputs (on FreeBSD
>> UNIX 14 and Slackware GNU/Linux 15) is a space (and not even newline
>> before shell prompt)...
>
> [...]
>> ------------------------------------------------------------------------
>> # print_file_words.awk
>> # pass filename to function
>> BEGIN { print_file_words("data.txt"); }
>>
>> # read two-column array from file and sort lines and print
>> function print_file_words(file) {
>> # set record separator then use print
>> # ORS=" "
>
> Move the above to a BEGIN section so it is executed once total instead
> of once per input line.
A function definition called once from the BEGIN section isn't
called "once per input line".
Janis
>
>> [...]
Back to alt.comp.lang.awk | Previous | Next — Previous in thread | Next in thread | Find similar
printing words without newlines? David Chmelik <dchmelik@gmail.com> - 2024-05-12 04:57 +0000
Re: printing words without newlines? Bruce Horrocks <07.013@scorecrow.com> - 2024-05-12 09:52 +0100
Re: printing words without newlines? Bruce Horrocks <07.013@scorecrow.com> - 2024-05-12 09:55 +0100
Re: printing words without newlines? gazelle@shell.xmission.com (Kenny McCormack) - 2024-05-12 12:11 +0000
Re: printing words without newlines? David Chmelik <dchmelik@gmail.com> - 2024-05-13 02:04 +0000
Re: printing words without newlines? Kaz Kylheku <643-408-1753@kylheku.com> - 2024-05-13 16:49 +0000
Re: printing words without newlines? gazelle@shell.xmission.com (Kenny McCormack) - 2024-05-13 06:56 +0000
Re: printing words without newlines? gazelle@shell.xmission.com (Kenny McCormack) - 2024-05-13 14:53 +0000
Resurrecting an old thread (Was: printing words without newlines?) gazelle@shell.xmission.com (Kenny McCormack) - 2024-07-15 18:10 +0000
Re: printing words without newlines? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-05-13 10:18 +0200
Re: printing words without newlines? Kaz Kylheku <643-408-1753@kylheku.com> - 2024-05-13 17:17 +0000
Re: printing words without newlines? gazelle@shell.xmission.com (Kenny McCormack) - 2024-05-13 17:26 +0000
Re: printing words without newlines? Kaz Kylheku <643-408-1753@kylheku.com> - 2024-05-13 23:33 +0000
Array indices are small integers? (Was: printing words without newlines?) gazelle@shell.xmission.com (Kenny McCormack) - 2024-05-14 13:40 +0000
Re: printing words without newlines? Ed Morton <mortonspam@gmail.com> - 2024-05-16 08:11 -0500
Re: printing words without newlines? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-05-16 15:55 +0200
Once upon a time... (Was: printing words without newlines?) gazelle@shell.xmission.com (Kenny McCormack) - 2024-05-16 14:15 +0000
Re: Once upon a time... (Was: printing words without newlines?) gazelle@shell.xmission.com (Kenny McCormack) - 2024-05-16 15:17 +0000
Re: printing words without newlines? Ed Morton <mortonspam@gmail.com> - 2024-05-16 19:40 -0500
csiph-web