我想切换这个:
**hg19chrc snpid a1 a2 bp info or se p ngt**
chr1 rs4951859 C G 729679 0.631 0.97853 0.0173 0.2083 0
chr1 rs142557973 T C 731718 0.665 1.01949 0.0198 0.3298 0
chr1 rs141242758 T C 734349 0.666 1.02071 0.02 0.3055 0
变成这样:
**CHR SNP A1 A2 BP info OR se p ngt**
chr1 rs4951859 C G 729679 0.631 0.97853 0.0173 0.2083 0
chr1 rs142557973 T C 731718 0.665 1.01949 0.0198 0.3298 0
chr1 rs141242758 T C 734349 0.666 1.02071 0.02 0.3055 0
我怎样才能实现这个目标?
答案1
纯文本文件?最简单的方法是将新的起始行(标题)放在尾部:
(echo "your header here"; tail -n +2 file) > outfile