Using grep to get the next WORD after a match in each line

前端 未结 6 1326
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-30 07:09

I want to get the \"GET\" queries from my server logs.

For example, this is the server log

1.0.0.127.in-addr.arpa - - [10/Jun/2012          


        
6条回答
  •  攒了一身酷
    2020-11-30 07:23

    In this case since the log file has a known structure, one option is to use cut to pull out the 7th column (fields are denoted by tabs by default).

    grep GET log.txt | cut -f 7 
    

提交回复
热议问题