With the match() function of GNU awk to store the matching group in an array, you could do
awk -F: ' BEGIN { OFS = FS-v }OFS=: match'match($1, /([0-9]+)$/ , arr ) { $2 = $2 "" arr[1] } 1' file On any POSIX complaintcompliant awk you could do
awk -v FS=F: ' BEGIN { OFS = FS-v }OFS=: match'match($1, /([0-9]+)$[[:digit:]]+$/ ) { $2 = $2 "" substr($0, RSTART, RLENGTH) }; 1' file See How to permanently change a file using awk? ("in-place" edits, as with "sed -i") to make the file change persistent.