Above : the prefix row number is not coming in sequence(Incrementing by using the preceeding lines that is not the actual data).
Initial file was containing additional info in flat file like column name @ begining , at the end of file few additional details that i wanted like count of records etc

I want the data in below format (Which shall have prefix row number and shall include only rows of table , not the additional preceeding and exceeding data)

1;NULL;ABCD;ABHJARS;;ABCD;ABCD;Y;;;;;;;;;A;
2;NULL;XEU-ANKD;XEU-AJKD;;ABCD;ABCD;Y;;;;;;;;;A;
3;NULL;SWAPOLEIL;SWAPOLEIL;;QWERDF;QWERDF;Y;;;;;;;;;A;
.
.
5436;11744;AMKDIONSKH;AMKDJ AN DJ JAHF AS CPFVH MTM;;QWERDF;QWERDF;Y;;;;;;;;;A;
5436 - is the number of rows present in the table from where i am fetching the data.

Thanks in advance!

(Tried the other suggested solutions as well . However, dint got the desired result)

Rajiv, welcome to U&L. You're kind of making a mess of the question & answer format that the site is suppose to adhere to. Can you please move the contents of the answer below into your question and mark those 2 answers as deleted? Please do this!
–
slm♦May 6 '14 at 13:37

If that's MySQL, then there is a batch option you can use to get machine-readable output. -B if I remember correctly.
–
derobertMay 6 '14 at 19:50

sed '/NULL/!d;s/ //g;=' | sed 'N;s/\n/:/' does all the stuff in your thing, and you only need two sed's there to remove the \newline generated by sed's = line counter needs removing. It would be simpler - and faster - still to use only one and pipe it to grep -n . or nl.
–
mikeservMay 7 '14 at 4:41

In fact - you'd have to do that or a third sed I guess for the same reason I use two greps any removed lines would still count in the output so you'd start at line 7 or something.
–
mikeservMay 7 '14 at 4:47