fork(1) download
  1. #!/bin/bash
  2. s='Continent1_Breed1_Ind-ID1 Continent1_Breed1_Ind-ID1 0 0 0 -9
  3. Continent1_Breed2_Ind-ID2 Continent1_Breed2_Ind-ID1 0 0 0 -0
  4. Continent2_Breed1_Ind-ID1 Continent2_Breed1_Ind-ID1 0 0 0 -9'
  5. awk '{sub(/_[^_]*$/, "", $1)}1' <<< "$s"
Success #stdin #stdout 0.01s 5516KB
stdin
Standard input is empty
stdout
Continent1_Breed1 Continent1_Breed1_Ind-ID1 0 0 0 -9
Continent1_Breed2 Continent1_Breed2_Ind-ID1 0 0 0 -0
Continent2_Breed1 Continent2_Breed1_Ind-ID1 0 0 0 -9