Last active
August 29, 2015 14:12
-
-
Save pontikos/8a9f21013c9c140b1d65 to your computer and use it in GitHub Desktop.
Prepends the string Levine_ to fields which do not start with the prefix Levine_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/awk -f | |
| BEGIN { | |
| OFS = FS | |
| } | |
| { | |
| # only one line starting with #CHROM needs to be modified in file | |
| # all others just print out unmoodified | |
| if ( $1 !~ /^#CHROM/ ) { | |
| print $0; | |
| } else { | |
| for (i=1; i < NF; i++) { | |
| # samples start at 10th field | |
| # if field does not start with Levine | |
| # does inplace replacement of the field, pretty handy | |
| if ((i > 9) && ($i !~ /^Levine/)) $i="Levine_"$i; | |
| } | |
| print $0; | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can be combined with bgziptabix to repace lines in VCF file: