Add header and footer with record count in footer

view full story

http://www.unix.com – This is my file(Target.txt) name|age|locaction abc|23|del xyz|24|mum jkl|25|kol The file should be like this 1|03252012 1|name|age|location 2|abc|23|del 2|xyz|24|mum 2|jkl|25|kol 2|kkk|26|hyd 3|4 Column 1 is row indicator for row 1 and 2, column indicator is 1,for data rows its 2 and for footer its 3. for footer the record count is is required. Please help me how to achive it (HowTos)