%{
#include&
#include&
int ln=0;
%}
%%
"\n" {}
.* {ln++;fprintf(yyout,"\n%d:%s",ln,yytext);}
%%
main()
{
yyin=fopen("try1.txt","r");
yyout=fopen("try2.txt","w");
yylex();
return 0;
}
int yywrap()
{
}
Sample output
try1.txt
hai
hello world
test file
language processor
try2.txt
1:hai
2:hello world
3:test file
4:language processor
Copyright secured by Digiprove © 2018 Humble Chirammal