#!/bin/bash awk -F ":" ' { for(i=NF;i>=2;i--) { printf("%s:",$i) } printf("%s\n",$1) } ' nowcoder.txt