Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.perl Subject: Re: Fast way to join lines ? Message-ID: <2967:Dec122:39:3790@kramden.acf.nyu.edu> Date: 1 Dec 90 22:39:37 GMT References: <9830001@hpfcso.HP.COM> Organization: IR Lines: 18 In article <9830001@hpfcso.HP.COM> hai@hpfcso.HP.COM (Hai Vo-Ba) writes: > I am using perl to join every N lines of a very large file > together and wonder what is the faster way to do this: The faster way is something like this: #include main() { int ch; int t = 33; while ((ch = getchar()) != EOF) { if (ch == '\n') if (--t) continue; else t = 33; putchar(ch); } } ---Dan Brought to you by Super Global Mega Corp .com