Looking at the man page of sort (from GNU coreutils 8.32),
-k, --key=KEYDEF
sort via a key; KEYDEF gives location and type
...
KEYDEF is F[.C][OPTS][,F[.C][OPTS]] for start and stop position, where F is a field number and C a character position in the
field;
both are origin 1, and the stop position defaults to the line's end. If neither -t nor -b is in effect, characters in a
field are
counted from the beginning of the preceding whitespace. OPTS is one or more single-letter ordering options [bdfgiMhnRrV],
which over‐
ride global ordering options for that key. If no key is given, use the entire line as the key. Use --debug to diagnose
incorrect key
usage.
First, you can use --debug as suggested,
$ sort -t',' -k1 -n --debug cemp1.txt
sort: text ordering performed using ‘en_IE.UTF-8’ sorting rules
sort: key 1 is numeric and spans multiple fields
10,30
_____
_____
50,900
______
______
20,1050
_______
_______
That gives us a clue: "key 1 is numeric and spans multiple fields".
As the man page says, "the stop position defaults to the line's end". So you need to add a stop position:
$ sort -t',' -k1,1 -n cemp1.txt
10,30
20,1050
50,900
sort?