Below is my sample test.log file
export SQRDIR=/v/orahome/Middleware/Oracle/bin64
export OID=ap0092
export PWD=pass1
export FDPWD=pass1
export AP0085_PWD=pass1
export SVR=AFFPROD
export TWO_TASK=db01
export EF_OID=AP0093
export EF_PWD=pass2
export CCC_PER_OID=CCC_JAS
export CCC_PER_PWD=pass3
export CAN_PER_OID=CAN_JAS
export CAN_PER_PWD=pass4
###################################################
The user inputs ap0092. Upon this input, I need to search for the first occurrence of PWD after the first occurrence of the search string i.e. =ap0092
Thus, the desired output will be pass1
Likewise, for CCC_JAS the desired output will be pass3
I need the solution for Solaris OS.
I was doing grep -A 1 [for non-Solaris] to get the next line but do not know how to search if the desired line may not be the very next line.
Please note: There may be multiple lines or Whiteline between export OID=ap0092 and
export PWD=pass1
Kindly suggest.