Thursday, October 27, 2016

Replace from line number X to line number Y using sed

To show text between lines

Fore example lines 2 and 5

sed -n '2,5p'  file

To replace string1 by string2  only in lines between 2 and 5

sed '2,5s/string1/string2/g' file

No comments:

Blog Archive