Getting a text file rid of all superfluous blank lines
Steven W. Orr
steveo at syslang.net
Sun Dec 4 02:17:52 UTC 2005
On Thursday, Dec 1st 2005 at 23:30 -0000, quoth Paul Smith:
=>So many ways of solving my problem show that this list is quite creative!
=>Paul
And why is it pray tell that no one thought to use *THE* most efficient of
all systems for this horribly CPU intensive task? I refer you all to flex
of course. As long as you're using deterministic regular expressions then
this is the best there is.
Here's foo.l
/* Note that the square brackets contain space tab */
%%%%%%%%%%%%%%%%%%START OF foo.l%%%%%%%%%%%%%%%%%%%
%%
[\n ] putchar('\n');
[\n ]{2,} puts ("\n\n");
.* printf ( "%s", yytext );
%%
#include <stdio.h>
%%%%%%%%%%%%%%%%%%END OF foo.l%%%%%%%%%%%%%%%%%%%
flex foo.l
gcc -O -o foo lex.yy.c -ll
./foo < input_file
--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
More information about the fedora-list
mailing list