Hi,
The above is the content of the file.(blank lines in between lines,at the begining of file and at the end of the file)
I am applying the following sed command
the output is
Note : inorder to represent a blank line i have used 'BlankLine'.
My doubt is how 1 blank line in begining and 1 blank line in between the lines are preserved. Also all blank lines at the end are removed.
Can anyone please explain this.?
Thank You
Code:
cat test.txt
BlankLine
BlankLine
BlankLine
BlankLine
ello
hi
helo
BlankLine
BlankLine
heylo
BlankLine
BlankLine
BlankLine
done
BlankLine
BlankLine
BlankLine
I am applying the following sed command
Code:
sed '/^$/N;/\n$/D' test.txt
Code:
BlankLine
ello
hi
helo
BlankLine
heylo
BlankLine
done
My doubt is how 1 blank line in begining and 1 blank line in between the lines are preserved. Also all blank lines at the end are removed.
Can anyone please explain this.?
Thank You