I have this script:
#!/bin/bash
user=datab-admin-role
allusers="datab-admin-111role datab-admin-112role datab-admin-113role "
if(...)
then..
...
I want to grep only the first occurrence of a string starting with datab
and ending with role
in a variable.
What I am trying is:
sed -n '/datab/,/role/p' filename
But it returns all the strings with datab and also it returns it as:
user=datab-admin-role
I want it to only return datab-admin-role
and assign it to a variable.