Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!bionet!ames!pacbell!rtech!gonzo!daveb From: daveb@gonzo.UUCP (Dave Brower) Newsgroups: comp.lang.c Subject: Re: Scrunch blank lines Summary: BZZT. Wrong answer Message-ID: <623@gonzo.UUCP> Date: 28 Mar 89 17:14:59 GMT References: <7150@siemens.UUCP> <9900010@bradley> <4896@cbnews.ATT.COM> <26389@cornell.UUCP> <6839@cg-atla.UUCP> Reply-To: daveb@gonzo.UUCP (Dave Brower) Distribution: na Organization: Gonzo Media Group Lines: 27 In article <6839@cg-atla.UUCP> duane@cg-atla.UUCP (Andrew Duane) writes: >> In article <620@gonzo.UUCP> daveb@gonzo.UUCP (Dave Brower) writes: >>So, I offer this week's challenge: Smallest program that will take >>"blank line" style cpp output on stdin and send to stdout a scrunched >>version with appropriate #line directives. [f]lex, Yacc, [na]awk, sed, >>perl, c, c++ are all acceptable. > >If shell scripts are acceptable, how about: > > #!/bin/sh > cat -s > >You may have to use "more" rather than cat. The moral: please >don't reinvent the wheel [1/2 ;-)] Sorry, you lept at the naive and incorrect solution. Please say "with appropriate #line directives." Cat -s obfuscates matching the output lines with the input lines. That is the point of the challenge. I have two entries so far, one in "lex" and another in "awk". Both are less than 20 lines. It will be interesting to compare timings between awk, gawk, nawk, lex and flex. -dB -- "I came here for an argument." "Oh. This is getting hit on the head" {sun,mtxinu,amdahl,hoptoad}!rtech!gonzo!daveb daveb@gonzo.uucp