[SOLVED] grep for a pattern inside log
by nextStep from LinuxQuestions.org on (#6H8HE)
hi Team,
I have a big log file in the below format
2023-12-18 21:50:47,236 xx.xx.xx.net [http-nio-8080-exec-31] INFO [application=mock-service, traceId=03318e367d976a7f, spanId=0437430f6e81a6e1] a.b.c.d.e.f.g.h.i - Pricing SDR fare value : 4195.20 and current fare : 0 for sdr W7KXK3
2023-12-18 21:50:54,056 xx.xx.xx.net [http-nio-8080-exec-31] INFO [application=mock-service, traceId=03318e367d976a7f, spanId=0437430f6e81a6e1] a.b.c.d.e.f.g.h.i - Pricing SDR fare value : 4195.20 and current fare : 0 for sdr W7KXK3
The requirement is to fetch the values as below
Pricing SDR fare value : 4195.20 and current fare : 0 for sdr W7KXK3
Pricing SDR fare value : 4195.20 and current fare : 0 for sdr W7KXK3
But when i give the
Code:zgrep "Pricing SDR fare value" <log file>The result have all the lines as below
2023-12-18 21:50:47,236 xx.xx.xx.net [http-nio-8080-exec-31] INFO [application=mock-service, traceId=03318e367d976a7f, spanId=0437430f6e81a6e1] a.b.c.d.e.f.g.h.i - Pricing SDR fare value : 4195.20 and current fare : 0 for sdr W7KXK3
How to get the exact match . I tried all possible combinations of zgrep and sed/awk but the result is printing all the lines.
Any help is appreciated
I have a big log file in the below format
2023-12-18 21:50:47,236 xx.xx.xx.net [http-nio-8080-exec-31] INFO [application=mock-service, traceId=03318e367d976a7f, spanId=0437430f6e81a6e1] a.b.c.d.e.f.g.h.i - Pricing SDR fare value : 4195.20 and current fare : 0 for sdr W7KXK3
2023-12-18 21:50:54,056 xx.xx.xx.net [http-nio-8080-exec-31] INFO [application=mock-service, traceId=03318e367d976a7f, spanId=0437430f6e81a6e1] a.b.c.d.e.f.g.h.i - Pricing SDR fare value : 4195.20 and current fare : 0 for sdr W7KXK3
The requirement is to fetch the values as below
Pricing SDR fare value : 4195.20 and current fare : 0 for sdr W7KXK3
Pricing SDR fare value : 4195.20 and current fare : 0 for sdr W7KXK3
But when i give the
Code:zgrep "Pricing SDR fare value" <log file>The result have all the lines as below
2023-12-18 21:50:47,236 xx.xx.xx.net [http-nio-8080-exec-31] INFO [application=mock-service, traceId=03318e367d976a7f, spanId=0437430f6e81a6e1] a.b.c.d.e.f.g.h.i - Pricing SDR fare value : 4195.20 and current fare : 0 for sdr W7KXK3
How to get the exact match . I tried all possible combinations of zgrep and sed/awk but the result is printing all the lines.
Any help is appreciated