Deutsch   English   Français   Italiano  
<v2538p$1jmvm$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: alt.comp.lang.awk,comp.lang.awk
Subject: Re: printing words without newlines?
Date: Thu, 16 May 2024 15:55:35 +0200
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <v2538p$1jmvm$1@dont-email.me>
References: <v1pi7c$2b87j$1@dont-email.me> <v250m9$1j3gp$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 16 May 2024 15:55:37 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="9f3fd79bbba27c4bfb23b295ab420ac6";
	logging-data="1694710"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18FBBDXAkQyGmzw9N/FcED+"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
Cancel-Lock: sha1:qIGvSmvlkqYcpWqqYqAU6TkK2hc=
In-Reply-To: <v250m9$1j3gp$1@dont-email.me>
Bytes: 2127

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

> 
>> [...]