Split a string

$ echo "abc:def:ghi" | awk -F':' '{print $3}'
ghi

Find and Replace with Incrementing Value

$ awk 'BEGIN {i = 0;}{ gsub(/([a-zA-Z0-9_]+)/, "foo"i++); print $0}' test.txt > out.txt