This cmd works fine on terminal line on RHEL7
grep -oPm1 '(?<=<app my_id=")[^<]+"my_name=
"xyz"+[^>] test.xml
But if I insert the line into a .sh script like:
grep -oPm1 '(?<=<app my_id=")[^<]+"my_name=
'"$var"'+[^>] test.xml
Where
$var="xyz"
It returns as blank.
I will hopefully have the above cmd in a loop
where var
is read from a text file.