Using sed command tried to match a value and then appending a value. Comd is working fine without variable but not able to pass the variable as expected.
eg:-This comd is working fine
sed -i 's/\( *OOZIEUSERS1 *\)[^ ]*\(.*\)*$/\1, test1,\2/' sudo_file.txt
but when running tru varible its not working:-
#!/bin/bash -x
read -p "Enter the reference account name : " ACC
read -p "Enter the user name to be inserted into VISUDO : " UNAME
sed -i 's/\( *$ACC *\)[^ ]*\(.*\)*$/\1, $UNAME,\2/' sudo_file.txt