Recently I was working on performing a sed operation on a config file.
I found that the sed command is behaving differently whenwith the parameter -ir isvs -ri :-
[root@node system]# sed -ri 's|(^[[:space:]]+[Kk]ernel.*$)|\1 transparent_hugepage=never|' temp_file
[root@node system]# echo $?
0
[root@node system]# sed -ir 's|(^[[:space:]]+[Kk]ernel.*$)|\1 transparent_hugepage=never|' temp_file
sed: -e expression #1, char 60: invalid reference \1 on `s' command's RHS
[root@node system]# echo $?
1
 
                 
                 
                 
                 
                