SyntaxFix
Write A Post
Hire A Developer
Questions
If Perl is an option, you can try this:
perl -ne 'printf "%s,$_" , $.-1' file
$_ is the line $. is the line number
$_
$.