grep/awk/sed的多条件查询
时间:2005-08-08 来源:honbj
|
# cat gt
one two three
four five six
one two
one seven three
# grep one three gt
grep: three: No such file or directory
gt:one two three
gt:one two
gt:one seven three
截取同时出现one和three的行,结果应该是:
one two three
one seven three
1. 用grep
cat gt | grep one | grep three
2. 用awk
awk '/one/&&/three/' gt
3. 用sed
sed -ne '/one/{/three/p}' gt
完毕
相关阅读 更多 +