Article 5PKT2 Bash Script Help

Bash Script Help

by
glennbtn
from LinuxQuestions.org on (#5PKT2)
Hi All, could do with some advise here.

I need to run a bash script to look for a line in a log and then exact the nu,ber in the brackets and set this as a variable which I can call later in my script but just don't know how to do it.

So in the log file I need to look for the line that contains eg
*666 in context mysubdomain.my domain.co.uk

I can do this with
grep -r '*666 in context mysubdomain.my domain.co.uk' /var/log/freeswitch/freeswitch.log

This then shows the full line of data in the file
e132cc14-f328-48f6-8dae-6e33570903f5 2021-09-16 10:26:06.827874 [INFO] mod_dialplan_xml.c:637 Processing 1003 <1003>->*666 in mysubdomain.my domain.co.uk

Now I need to extract the value in between the <> brackets, so in this case the 1003 and set 1003 as a variable

Can anyone advise how I could do this please

Thankslatest?d=yIl2AUoC8zA latest?i=tFzEKWGrA7Q:umUye69o3vU:F7zBnMy latest?i=tFzEKWGrA7Q:umUye69o3vU:V_sGLiP latest?d=qj6IDK7rITs latest?i=tFzEKWGrA7Q:umUye69o3vU:gIN9vFwtFzEKWGrA7Q
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments