Se você deseja classificar / testar a exclusividade do campo primeiro especificamente, e seu sistema tem a versão GNU coreutils de sort , então eu acho que você poderia usar apenas
sort -nu file
viz.
$ sort -nu file
123 some text
334 some other text
341 more text
De info coreutils 'sort invocation'
The commands
sort -uandsort | uniqare equivalent, but this equivalence does not extend to arbitrarysortoptions. For example,sort -n -uinspects only the value of the initial numeric string when checking for uniqueness, whereassort -n | uniqinspects the entire line.