この表現は何をしているのでしょうか?
grep -i Keyword1 | grep -i Keyword2 file.txt
キーワード1またはキーワード2のいずれかを含む行を返すことになっていますか?それは私が得ているものではないので、私はこれを尋ねます。私はどういうわけか常にキーワード2の行を取得していて、また物事が完了していないようです。つまり、通常のコマンドを実行すると、終了後にコマンドプロンプトに戻ります。上記を実行すると発生しますが、ここで何らかの配管が発生していますか?
This doesn't really make sense. | is a pipe, it redirects stdin/stdout: a | b redirects as stdout to bs stdin. grep, without a file as parameter, will take input from stdin, which is why your command doesn't return.
What you want is
grep -i Keyword1 file.txt | grep -i Keyword2
Which will grep for Keyword1, and the output will be grepped for Keyword2. This will result in a logical and, filters for Keyword1 AND Keyword2.
論理和が必要な場合は、grep -Ei '(Keyword1|Keyword2)' file.txt
あなたが現在持っているものは奇妙で間違っています。これはあなたがやろうとしていることです:
grep -i Keyword1 file.txt | grep -i Keyword2
これにより、論理積が得られます。