Issue
sed 's!//window!window!' index.html
Above is the command which replaces all instances of //window
. I just wanted to replace the first instance or only the first occurrence of //window
to window
.
Solution
If you are using GNU sed
, try -
sed '0,/\/\/window/s//window/' index.html
This code will replace the first instance of //window
with window
and stop thereafter.
Answered By - B. Kapoor Answer Checked By - Katrina (WPSolving Volunteer)