t - tests to see if the previous edit actually occurred. This is basically a version of branch that test status of last edit executed rather than an address. The test and branch may target the same label.
:label
[address]b[label]
sed -e ' # print the line pre-edit p # if the line contains 2 or more instances of the word house # change all but 1st to home :again s/\<house\>/home/2 t again # if the contains a series of slashes, convert all but the # 1st and last to star :sagain s#/#*#2 /\/\// b again p :pagain s/\*\*/*|/ t pagain' /home/hopper/berezin/Data/myhouse
The following removes single blank lines between lines of text. If there are more than 1 consecutive blank lines, they are ignored.
#1st make sure blank lines are empty sed -e 's/^[ ]*$//' /home/hopper/berezin/Data/linedata | sed -e ' #If line as text, skip edits. /^./ b # fetch next line N # If both lines blank, skip edits. /^\n$/b # if 2nd line not empty /^\n..*$/ { # Delete new line s/^\n// } ' | lessA word on multi-edit sed with embedded comments on the command line, bash is very forgiving of this style of command entry. If you find you need to work in a different shell, you may want to keep all your edits in a file and use sed -f to fetch them.