Grep for 2 words after pattern found

Posted by Dileep Ch on Stack Overflow See other posts from Stack Overflow or by Dileep Ch
Published on 2012-12-07T12:06:43Z Indexed on 2012/12/13 17:03 UTC
Read the original article Hit count: 203

Filed under:
|

The scenario is i have a file and contains a string "the date and time is 2012-12-07 17:11:50"

I had searched and found a command

grep 'the date and time is' 2012-12-07.txt | cut -d\   -f5

it just displays the 5th word and i need the combination of 5th and 6th, so i tried

grep 'the date and time is' 2012-12-07.txt | cut -d\   -f5 -f6 

But its error.

Now, how to grep the 5th and 6th word with one command

I just need the output like 2012-12-07 17:11:50

© Stack Overflow or respective owner

Related posts about linux

Related posts about grep