I tried unxutils\' wc -l but it crashed for 1GB files. I tried this C# code
long count = 0;
using (StreamReader r = new StreamReader(f))
{
st
Have you tried flex?
%{
long num_lines = 0;
%}
%option 8bit outfile="scanner.c"
%option nounput nomain noyywrap
%option warn
%%
.+ { }
\n { ++num_lines; }
%%
int main(int argc, char **argv);
int main (argc,argv)
int argc;
char **argv;
{
yylex();
printf( "# of lines = %d\n", num_lines );
return 0;
}
Just compile with:
flex -Cf scanner.l
gcc -O -o lineCount.exe scanner.c
It accepts input on stdin and outputs the number of lines.