过滤包含任何顺序的字符集的所有成员的行

时间:2016-01-15 01:07:21

标签: bash

这个问题需要只编写一行命令来打印一些文本,将文件作为输入。打印的内容需要包含所有" aeiou"字符。字符出现的顺序无关紧要。

enter image description here

3 个答案:

答案 0 :(得分:1)

awk '/a/&&/e/&&/i/&&/o/&&/u/' FILE_NAME

答案 1 :(得分:0)

这样做但它并不漂亮,肯定有一种方法可以在一个命令中完成它。

grep 'a' test | grep 'e' | grep 'i' | grep 'o' | grep 'u'

答案 2 :(得分:-1)

不确定,但是类似的东西:

cat "filename" | grep "word_you_search"