With perl List::MoreUtils, by evaluating the distinct / uniq elements in scalar context:
perl -MList::MoreUtils=distinct -F, -lne ' print( (distinct @F) > 1 ? "no_match" : $F[0]) ' example 1-69 no_match 1-46 no_match 6-1 5-51 4-59 With perl List::MoreUtils, by evaluating the distinct / uniq elements in scalar context:
perl -MList::MoreUtils=distinct -F, -lne ' print( (distinct @F) > 1 ? "no_match" : $F[0]) ' example 1-69 no_match 1-46 no_match 6-1 5-51 4-59