#!/bin/bash
echo -e "test1:test2:test3" | sed 's/:/\n/g' | grep 1
sed -E "s/(.*:)?([^:]*1[^:]*).*/\2/" <<< "test1:test2:test3"
sed "s/:/\n/g" <<< "test1:test2:test3" | sed -n "/1/p"
awk -v RS=":" '/1/' <<< "test1:test2:test3"
awk 'BEGIN{RS=":"} /1/' <<< "test1:test2:test3"
IyEvYmluL2Jhc2gKCmVjaG8gLWUgInRlc3QxOnRlc3QyOnRlc3QzIiB8IHNlZCAncy86L1xuL2cnIHwgZ3JlcCAxCnNlZCAtRSAicy8oLio6KT8oW146XSoxW146XSopLiovXDIvIiA8PDwgInRlc3QxOnRlc3QyOnRlc3QzIgpzZWQgInMvOi9cbi9nIiA8PDwgInRlc3QxOnRlc3QyOnRlc3QzIiB8IHNlZCAtbiAiLzEvcCIKYXdrIC12IFJTPSI6IiAnLzEvJyA8PDwgInRlc3QxOnRlc3QyOnRlc3QzIgphd2sgJ0JFR0lOe1JTPSI6In0gLzEvJyA8PDwgInRlc3QxOnRlc3QyOnRlc3QzIg==