mercredi 18 décembre 2019

large tab delimited file manipulation in shell

I have a big file with 200000 rows and 150000 columns. I want to switch two columns with one another if the third column starts with a string.

Input:

sr1  .  A  B  x|y:abc:xyz 
sr2  .  B  D  y|y:abc:xyz
sr3  .  G  F  x|y:abc:xyz
sr4  .  Z  C  y|x:abc:xyz
sr5  .  Z  D  x|y:abc:xyz

Output if 5th column starts with x|y

sr1  .  B  A  x|y:abc:xyz
sr2  .  B  D  y|y:abc:xyz
sr3  .  F  G  x|y:abc:xyz
sr4  .  Z  C  y|x:abc:xyz
sr5  .  D  Z  x|y:abc:xyz

Can I do it in shell or using awk?

Aucun commentaire:

Enregistrer un commentaire