This question may be too simple for most of you, but I really don't want to do it manually. So, suppose I have a file in terminal such like this:
[dz2t@edison-s GWAS]$ head $PHENO
GWASID CHILDID VSTNUM GENDER GA
1001 1001 11 Female -9
1002 1002 11 Male -9
1003 1003 11 male -9
1004 1004 11 male -9
1005 1005 11 Female -9
1006 1006 11 Female -9
How to change the names of first two columns from "GWASID" and "CHILDID" to "FID" and "IID". And the others remain unchanged?
You can do this:
That says, on line 1 only, substitute GWASID with FID and CHILDID with IID. If you want it to overwrite the file, you need to add the
-i
flag after the wordsed
for in-place editing.