I have data:
7456 7456 0 0 0 2
7463 7463 0 0 1 2
I want to add column headers so the output is:
FID IID PAT MAT SEX PHENOTYPE
7456 7456 0 0 0 2
7463 7463 0 0 1 2
I have tried echo -e "FID\tIID\tPAT\tMAT\tSEX\tPHENOTYPE" | cat file1 > file2
But this is copying the original file and not the headers.
sed '1i\FID, IID, PAT, MAT, SEX PHENOTYPE' file1 > file2
has the error
sed: 1: "1i\FID, IID, PAT, MAT, ...": extra characters after \ at the end of i command
Any advice please?
echo -e "FID\tIID\tPAT\tMAT\tSEX\tPHENOTYPE" | cat - file1 > file2
– Sundeep Oct 31 '17 at 16:07(echo ....; cat file1) > file2
. – NickD Oct 31 '17 at 16:25