'How to pick words in a log file using shell script

I am trying to pick words start with "Approved by" and end with after "AAAA" letters . here is log file.

Test worker] INFO cyyom.bghhht.gsghhj.dijjkkgital.dggcf.applicationservice.service.RequestServiceImpl - Approved List : 
[AssignAccountApplicationRequestDto [status=true, requestId=1, backendData=BackendPopupDto [userID=0, companyId=0, ApplicationId=0, 
userType=Test, corpId=0, revenueOwner=notnull, requestedDate=null]]] , Rejected List : [AssignAccountApplicationRequestDto [status=false, requestId=11, backendData=null]]
Approved by ha:////4P4ei7QWIY1VDT3ygY1geg0Q82Jj2AqLzGAAAAmh+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/
JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAyxEgY+/
dLi1CL99OKCxJTczDwAUT2GdsMAAAAXLPortal Administrator

I tried

awk -F'=' '/^Approved by / && NF>=2{print $NF}' log

expected output

XLPortal Administrator


Solution 1:[1]

With your shown samples please try following awk program.

awk '
match($0,/AAAA[ =].*/){
  val=substr($0,RSTART,RLENGTH)
  gsub(/AAAA[ =]+/,"=",val)
  print val
}
' Input_file

Solution 2:[2]

Using sed

$ sed -n s'/.*AAA\([[:alpha:] ]*\)$/\1/p' input_file
XLPortal Administrator

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2