某列纯数字输出
echo 2563 | awk ‘{if(
0
/
[
0
−
9
]
+
0 ~ /^[0-9]+
0 /[0−9]+/) print $0}’
2563
某列纯字母输出
echo adxf | awk ‘{if(
0
/
[
a
−
z
A
−
Z
]
+
0 ~ /^[a-zA-Z]+
0 /[a−zA−Z]+/) print $0}’
adxf
当有数字也有字母或者相反时,无输出
echo adxf | awk ‘{if(
0
/
[
0
−
9
]
+
0 ~ /^[0-9]+
0 /[0−9]+/) print $0}’
echo adxf0256 | awk ‘{if(
0
/
[
a
−
z
A
−
Z
]
+
0 ~ /^[a-zA-Z]+
0 /[a−zA−Z]+/) print $0}’