Yes, I sure can work with this.
I will dissect it and make it work the way I want!
I'm amazed at this little command and how versatile it is, the reason I want to get to know it!!
I was trying to find the L switch, but it is a label called L working with T. If not find pattern then go back and repeat until pattern found !!
Great!
sed -n '/.*oy\/size">\(.*\).*$/ {s//\1/; :L; N; s/<\/note-content>//p; TL}'
It looked daunting at first but then...
---------- Post updated at 11:32 AM ---------- Previous update was at 10:40 AM ----------
sed -n '/.*oy\/size">\(.*\).*$/ {s//\1/; :L; N; s/<\/note-content>//p; TL}'
sed -n '/.*oy\/size">\(.*\).*$/ {s//\1/;
Find pattern, cuts it out, s// finds nothing so prints remainder of pattern buffer. So it acts like the p
:L; N; s/<\/note-content>//p; TL}'
First pass N loads next line into pattern space, no match, unloads pattern space with p, blank line.
Goes back then finds pattern, which is deleted with // and then prints remainder with p
Next, EOF, so out.
Is this right the way I correlated the actions to the proper command sets?
The let's call it "empty regex" uses the last one applied right before. In this case: reuse the address one to find the line. (Not easy to find in the docu. I didn't. I learned it from these forums.) Nothing is printed here.
Nothing is deleted. N just collects line after line into pattern space. The p flag to sed 's s(ubstitute) prints only if a substituition was made, i.e. when the pattern was found. Then also ignore the T command and leave.