I want to replace the content of my Column 1 with "chr" added into it. But I want this to be added from the 15th line onwards, otherwise it changes the header information.
I used this command:
awk '{$1 = "chr"$1; print}' sample81a.vcf > sample81A.vcf
but like I mentioned,` it is changing the header too.
How to ensure that the "chr" starts only from line 15 of column 1.
Thanks
您可以使用NR>=15
条件从第15行开始在{...}
内部执行代码:
awk 'NR>=15 {$1 = "chr" $1} 1' sample81a.vcf > sample81A.vcf
尝试以下代码:
$ awk 'BEGIN{count=0}{++count;if(count >= 15)$1="char"$1;print}' sample81a.vcf > sample81A.vcf
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.