Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!gatech!usenet.ins.cwru.edu!tut.cis.ohio-state.edu!ucbvax!cc.helsinki.fi!KKTK_KOTUS From: KKTK_KOTUS@cc.helsinki.fi Newsgroups: comp.lang.icon Subject: A word/line procedure Message-ID: <124E207800E17F06@cc.Helsinki.FI> Date: 16 May 91 14:25:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 54 Dear iconists, I have a following, obviosly simple problem. I have made a nice Icon procedure, which divides a text file one word/line. It is much easier, simpler and faster than the one given in Icon book. It goes like this (the original idea is, I believe, from some Unix-procedure, and it is the same thing you would do with any editor or text processing program, if you had to use them for the work): procedure main() while line:=read() do write(map(line," ","\l")) end It works fine and fast, but it produces also empty lines which I cannot get rid off in the same procedure, although I try to filter them out with something like if *line > 0 then write(line) But if I make the first procedure to write the stuff in a file and then process that file with the procedure procedure main() while line:=read() do if *line > 0 then write(line) end I get rid off the empty lines. It is easy to make a .bat or .com or whatever from these two procedures, and the whole thing still works at least as fast or even faster than the procedure in the Icon book. But I would still like to know, how I actually could make it work in one shot. I have tried different solutions, but they do not work. Can anybody explain it? Greetings, Kimmo Kettunen KKTK_KOTUS@CC.HELSINKI.FI