Skip to main content
deleted 5 characters in body
Source Link
Philippe
  • 1.5k
  • 9
  • 15

If you want toTo sort by position 28, this is the waywe need to gouse NUL separator :

sort -t '\0' -k 1.28 file
id - 884209 , researchers - 1
id - 904091 , researchers - 1
id - 905525 , researchers - 1
id - 916197 , researchers - 1
id - 910480 , researchers - 10
id - 901026 , researchers - 15
id - 896781 , researchers - 4
id - 908660 , researchers - 5
id - 908876 , researchers - 7

If you want to sort by position 28, this is the way to go :

sort -t '\0' -k 1.28 file
id - 884209 , researchers - 1
id - 904091 , researchers - 1
id - 905525 , researchers - 1
id - 916197 , researchers - 1
id - 910480 , researchers - 10
id - 901026 , researchers - 15
id - 896781 , researchers - 4
id - 908660 , researchers - 5
id - 908876 , researchers - 7

To sort by position 28, we need to use NUL separator :

sort -t '\0' -k 1.28 file
id - 884209 , researchers - 1
id - 904091 , researchers - 1
id - 905525 , researchers - 1
id - 916197 , researchers - 1
id - 910480 , researchers - 10
id - 901026 , researchers - 15
id - 896781 , researchers - 4
id - 908660 , researchers - 5
id - 908876 , researchers - 7

added 2 characters in body
Source Link
Philippe
  • 1.5k
  • 9
  • 15

If you want to sort by position 28, this is the way to go :

sort -t \0'\0' -k 1.28 file
id - 884209 , researchers - 1
id - 904091 , researchers - 1
id - 905525 , researchers - 1
id - 916197 , researchers - 1
id - 910480 , researchers - 10
id - 901026 , researchers - 15
id - 896781 , researchers - 4
id - 908660 , researchers - 5
id - 908876 , researchers - 7

If you want to sort by position 28, this is the way to go :

sort -t \0 -k 1.28 file
id - 884209 , researchers - 1
id - 904091 , researchers - 1
id - 905525 , researchers - 1
id - 916197 , researchers - 1
id - 910480 , researchers - 10
id - 901026 , researchers - 15
id - 896781 , researchers - 4
id - 908660 , researchers - 5
id - 908876 , researchers - 7

If you want to sort by position 28, this is the way to go :

sort -t '\0' -k 1.28 file
id - 884209 , researchers - 1
id - 904091 , researchers - 1
id - 905525 , researchers - 1
id - 916197 , researchers - 1
id - 910480 , researchers - 10
id - 901026 , researchers - 15
id - 896781 , researchers - 4
id - 908660 , researchers - 5
id - 908876 , researchers - 7

Source Link
Philippe
  • 1.5k
  • 9
  • 15

If you want to sort by position 28, this is the way to go :

sort -t \0 -k 1.28 file
id - 884209 , researchers - 1
id - 904091 , researchers - 1
id - 905525 , researchers - 1
id - 916197 , researchers - 1
id - 910480 , researchers - 10
id - 901026 , researchers - 15
id - 896781 , researchers - 4
id - 908660 , researchers - 5
id - 908876 , researchers - 7