bar*_*lop 3 linux windows command-line cygwin gnuwin32
如果我有一个不同长度的十六进制数的文件,例如
1F
b
c
Run Code Online (Sandbox Code Playgroud)
如何从命令行对它们进行排序?
Linux解决方案是受欢迎的,但我将使用windows和cygwin或gnuwin32.
注意:我显然不能使用SORT'cos来保持它们的顺序是错误的.
cat thefile | while read line; do printf "%d %s\n" "0x$line" "$line"; done | sort -n | awk '{print $2}'
Run Code Online (Sandbox Code Playgroud)
这保留了十六进制数字的原始大小写.