This is easy to do in sed if you can embed the title bar directly in the command:
$ sed -i "1iheader1,header2,header3"
Or if you really want to read it from a file, you can do this using bash help:
$ sed -i "1i$(<header)" file
BEWARE , which "-i" overwrites the input file with the results. If you want sed to back up, change it to "-i.bak" or similar, and of course always check the sample data in the temp directory first to make sure you understand what will happen before you apply to your real data.
daveadams
source share