- 论坛徽章:
- 60
|
也可以写成- awk -F'\t' 'BEGIN{id="201506021717179991015"}$1==id' file
复制代码 这样也是字符串比较了!
awk 对类型的判断遵循的原则:- A numeric constant or the result of a numeric operation has the numeric attribute.
- A string constant or the result of a string operation has the string attribute.
- Fields, getline input, FILENAME, ARGV elements, ENVIRON elements, and the elements
- of an array created by match(), split(), and patsplit() that are numeric strings
- have the strnum attribute. Otherwise, they have the string attribute. Uninitialized
- variables also have the strnum attribute.
- Attributes propagate across assignments but are not changed by any use.
- STRING NUMERIC STRNUM
- STRING string string string
- NUMERIC string numeric numeric
- STRNUM string numeric numeric
复制代码 |
|