openwrt工程上默认编译成功后linux系统中sort命令是简单的不支持-k等参数,首先在编译前选上支持-k等参数,在make menuconfig后,依次选中"Base system"->"busybox"->"coreutils"->"Full SuSv3 compliant sort (support -ktcsbdfiozgM)",编译成功的系统支持sort -k参数。
来看看我们使用的选项说明
-n, --numeric-sort compare according to string numerical value
-t, --field-separator=SEP use SEP instead of non-blank to blank transition
-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.
来自: