Column names in flat files

Hi all,

I want to create column names in a flat file and then load the data through some other application. For example, I have a file with emp.txt and I need column names as eno,ename,sal in the first line. The delimiter here is comma and record delimiter is end of line or unix new line. Could someone help me out in this.

Get the column headers somehow and write them into a new file. Then append the records you have to this file. The script can contain the following commands.

echo "eno,ename,sal" > temp_file
cat emp.txt >> temp_file
mv temp_file emp.txt

Regards,
Rahul.