Can any one help me how the sed delete only first line command (D) works.
sed -f sedcmds File.txt
In this how the sed delete only first line command (D) works to delete the blank lines appearing more than ones leaving only one blank and deleting others blanks.
While doing step by step when two blank line appended in the pattern space, according to D command one blank is deleted in the pattern space leaving second one alone.
My question is what will happen to the remaining blank space, whether it will send as output immediately by clearing pattern space or append next pattern to that blank space???. After this how the next loop will start?
Can u explain this detailly... coz I couldn't able to find the detailed explanation for sed's D delete command in net.
sedcmds
/^$/{
N
/^\n$/D
}
File.txt
This is line1
This is line2
this is line3
This is line4.