Find and replace text in a file between range of lines using sed
You can use sed addresses:
sed '19,33s/google/facebook/g' file
This will run the substitution on lines between and including 19 and 33.
The form of a sed command is as follows:
[address[,address]]function[arguments]
Where 19,33
is the addreses,s
ubstitute is function
and g
lobal is the argument
the above answer ALMOST worked for me on Mac OSX.
sed '19,33s/google/facebook/' file
worked perfectly without braces.
sed '19,$s/google/facebook/' file
works until the end of the file as well.