|
From: | Jim Dailey |
Subject: | Re: readdir extension on windows with getline |
Date: | Thu, 26 Jan 2023 09:07:04 -0600 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 |
From: Jim Dailey <jim.dailey@alumni.utexas.net>
I have successfully used the readdir extension on windows with directory names on the command line. But if I try to execute "getline < {some directory path}", my script hangs. I have to Ctrl-C to get control. Ctrl-Z (EOF) does nothing to move things along. I have tried using getline with a directory path in BEGIN, in END, and in a normal pattern, each time with the same result. It seems like the extension doesn't work with getline on windows. Here is the basic attempt: PathCount = split(ENVIRON["AWKPATH"],AwkPath,/;/) for (i = 1; i <= PathCount; i++) { while (getline < AwkPath[i]) { split($0,Data,/\//) print Data[2] } } If I replace AwkPath[i] with an actual path like "C:\etc\pscal\pscal\gawk\lib", there is no change in behavior. If you have successfully used readdir with getline in windows, perhaps you have some idea what I may be doing incorrectly?I get the same results on Windows and on GNU/Linux. AFAICT, the readdir extension cannot be used with getline, since getline redirection seems to ignore the registered input parsers. IOW, this is not currently supported.
I guess I was misled by section 17.7.6 of version 5.1 of the manual: The readdir extension adds an input parser for directories. .. When this extension is in use, instead of skipping directories named on the command line (or with getline), they are read, with each entry returned as a record. It seems "(or with getline)" should be removed from the manual. Thanks, FormerBiosGuy
[Prev in Thread] | Current Thread | [Next in Thread] |