Artificial intelligent assistant

Split columns based on patterns in fields Example: I'd like to split `$2` in input file, putting a `tab` after pattern `surname` Input: name surname1 name surname30000 name surname456 Desired output: name surname 1 name surname 30000 name surname 456

An **awk** alternative:


awk 'match($2,/[0-9]+$/) {printf("%s\t%s\t%s\
", $1, substr($2,0,RSTART), substr($2,RSTART,RLENGTH))}' filename


This will match only the numeric string at the end of the second column.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 25bfed8d13e488e0d627b66e2f90e523