I have a variable name defined as HOSTIP=10.10.10.10, so
echo $HOSTIP
prints 10.10.10.10
I have a system file sshd_cnfg, and at some place it has lines
#ListenAddress 0.0.0.0
#ListenAddress ::
I want to INSERT text
ListenAddress $HOSTIP:22
after the last line containing #ListenAddress, i.e. after
#ListenAddress ::
so that after insertion the sshd_cnfg file will read
#ListenAddress 0.0.0.0
#ListenAddress ::
ListenAddress 10.10.10.10:22
at that place.
I have tried very many combinations of "sed" command, but with no
success.
I don't know the line number of any line in sshd_cnfg file.
Can someone please tell me the exact syntex involving "sed."
Thanks in anticipation. I will greatly appreciate this help.
nagrik