Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Find sessionids after match

$
0
0
Hi Guys,

I need a help on writing shell scripting where I am stuck on finding keyword after a grep match.

file.log (sample)
Code:

line1 -> ppp dfasf adgasg session out sfsgsgsghsgh
line2 -> sdaf agasg sessionid: 1234Nhsh34 sdagsjhsh srhs
line3 -> sdgshytnba sessionid: 453omgt  thdjdh gfhjdj
line4 -> sdshdh fhadhj kdrtryf session out pekgtocv
line5 -> eropjsdf dgfp sessionid: 453omgt ppwnf
line6 -> eed bbbvf sessionid: 1234Nhsh34 dgswq dfvg


Example:
There is one log file where I grep one string like 'session out' and straight after this I need to get all the 'sessionid' before next 'session out' and scan to compare each sessionid to find if same sessionid exist in same log file.

Please let me know if more details are required.

Viewing all articles
Browse latest Browse all 16232

Trending Articles