每天进步一点点
全部博文(137)
分类:
2005-08-08 16:02:09
|
# 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
完毕