i trying replace occurrences of open not open. want print original text modified lines indented , preserved in original form followed modified form.
this command not enough:
sed 's/open/not open/' file.txt sample input:
this first line of text text open , next line of text sample output:
this first line of text text open text not open , next line of text
this might work (gnu sed):
sed '/\<open\>/!b;s/^/\t/p;s/\<open\>/not &/g' file any line not contain word open print normal. otherwise, insert tab @ start of line , print original line, replace open not open , print.
Comments
Post a Comment