f**g 发帖数: 28 | 1 Hi All,
Does anyone know how to set cutoff for the sort command in the Unix system?
such as
1 desk 200
2 book 300
3 chair 100
How can I filter out the Number < 200 items, and keep the rows with larger
number (200 and 300)?
Many thanks in advance.
F |
I*l 发帖数: 1649 | 2 没看懂
直接sort,然后自己cut off前半部分不就行了
?
【在 f**g 的大作中提到】 : Hi All, : Does anyone know how to set cutoff for the sort command in the Unix system? : such as : 1 desk 200 : 2 book 300 : 3 chair 100 : How can I filter out the Number < 200 items, and keep the rows with larger : number (200 and 300)? : Many thanks in advance. : F
|
c*******a 发帖数: 18 | 3 use awk
?
【在 f**g 的大作中提到】 : Hi All, : Does anyone know how to set cutoff for the sort command in the Unix system? : such as : 1 desk 200 : 2 book 300 : 3 chair 100 : How can I filter out the Number < 200 items, and keep the rows with larger : number (200 and 300)? : Many thanks in advance. : F
|
c*******a 发帖数: 18 | 4 suppose your file name is feng.txt
use the following command
awk '{if ($3 >=200) print $0}' feng.txt|sort -k 3b
?
【在 f**g 的大作中提到】 : Hi All, : Does anyone know how to set cutoff for the sort command in the Unix system? : such as : 1 desk 200 : 2 book 300 : 3 chair 100 : How can I filter out the Number < 200 items, and keep the rows with larger : number (200 and 300)? : Many thanks in advance. : F
|