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