#!/bin/bash awk -F ':' 'BEGIN{arr=""} { for(i=NF;i>=1;i--){ if(i==NF){ s=$i; }else{ s=s":"$i; } } print s }' nowcoder.txt