0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

awkで特定の列を抽出

Posted at

やりたいこと

  • 任意のファイルから特定の列を出力させたい。

commannd

  • あるログファイルの中からKubernetesという文字だけ抽出するサンプル。
$ cat test
[2020-11-18 04:18:17 DEBUG] [__init__:66] Using Kubernetes context: default
$ cat test | awk -F" " '{print $6}'
Kubernetes
  • 空白区切りじゃなくカンマ区切りの場合は以下のように指定する。
$ cat test | awk -F"," '{print $6}'
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?