fork download
  1. #!/bin/bash
  2.  
  3. awk '
  4. BEGIN {FS=OFS="\t"}
  5. NR > 1 && tolower($3) != $3 && split($3, a, / +/) >= 2 {
  6. p = (a[1] == tolower(a[1]) ? 2 : 1)
  7. $3 = a[p] " " a[p+1]
  8. }
  9. 1'
Success #stdin #stdout 0.01s 5312KB
stdin
ol1	col2        	col3
123 	a string    	James jones MD MSc
154 	string      	mister George smith
163 	String      	mrs anne jones
193 	String      	john
157 	big string 1	dude George
stdout
ol1	col2        	col3
123 	a string    	James jones
154 	string      	George smith
163 	String      	mrs anne jones
193 	String      	john
157 	big string 1	George