Skip to main content
2 of 2
more idiomatic
steeldriver
  • 83.9k
  • 12
  • 124
  • 175

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 
steeldriver
  • 83.9k
  • 12
  • 124
  • 175