This might work for you:
< file awk '{p=index($3,"Chr"); $3=substr($3,p); print}' | column -t
This looks for the substring "Chr" in the third field, and sets the third field to the remainder starting with Chr. (If "Chr" is not found, the whole field remains.)
Unfortunately, awk merges whitespace when you change part of the line. column -t
lines up the columns again.
That results in
start end chr
1 10 Chr01
10 50 Chr02
(Notice the columns have changed alignment.)
If that's not good enough, we can adapt this answer on StackOverflow by Håkon Hægland:
awk '{n=split($0,fields," ",seps); p=index(fields[3],"Chr"); fields[3]=substr(fields[3],p); line=seps[0]; for (i=1; i <=n; i++) { line=(line fields[i] seps[i]); } print line; }' file
which is probably worth putting in its own awk script, instead of running on the command line.
#!/usr/bin/awk -f
{
n = split($0, fields, " ", seps)
p = index(fields[3], "Chr")
fields[3] = substr(fields[3], p)
line = seps[0]
for (i=1; i <=n; i++)
line=(line fields[i] seps[i])
print line
}
If that's saved in say coledit.awk
and made executable, then running ./coledit.awk file
results in your desired output (with original whitespace unchanged).