echo "$mylineoftext" | awk '{ print substr($0, index($0, ":") ) }' # question 1 echo "$mylineoftext" | awk '{ print substr($0, length($0) -5 ) }' # question #2