Reputation: 523
Im trying to search a text like this below in my log files in Unix box i.e. it starts with text 'TransactionTime:' and then after some characters there is a bracker [ with some numbers inside and then closed by ]
For e.g.
TransactionTime: 1407258546484 -> 1407258552848 [ 6364 ]
I tried a couple of combinations to search this in my unix file using Grep but it didnt help me, how can i search and print all these lines in my console or output file ?
File name is TransactionPerformance.log
Thanks
Upvotes: 1
Views: 74
Reputation: 85
For the sake of choice I would try ack
an improved version of grep -> enter link description here
ack '^TransactionTime:.*\[ [\d]+ \]' *
Upvotes: 0
Reputation: 174706
You could try the below grep command which use -P
(Perl regexp) parameter,
grep -P '^TransactionTime:.*?\[[\s\d]+\]' *
Upvotes: 1