Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ログファイル内のいくつかの単語を検索し、ファイル内のそれらの行から指定された列番号のみを表示したいと考えています。 例: abc.log で「単語」を検索し、列 4,11 を出力したい
grep "word" abc.log | awk '{print $4}' | awk '{print $4}'
しかし、これはうまくいきません。誰か助けてください
別の にパイプするのではなく$4、一緒に印刷する必要があります。$11$4awk
$4
$11
awk
また、 can があるgrepので必要ありません。awkgrep
grep
次のようにしてみてください。
awk '/word/{print $4,$11}' abc.log