I need to use sed to change a string in a file only on the 4th line if it contains a string called "test"
So basically What I got right now is:
sed '/test/ s/abc/zz/g' sample
This will basically look through the lines and see if it has test and than change the abc to zz if its in that line.
But how do I do it only for the 4th line.
I tried
sed '/test/ 4s/abc/zz/g' sample
Adding the 4 infront of the s , but it doesnt work.