I have a file with the following contents:
Windows user
I love windows
Windows 10
# I like it
# I want to keep these two lines
Just started with my job
New to shell scripting as well
New to Mac
Please help!
#EOF
I want to delete all the lines:
starting from "I love windows
" to "New to shell scripting as well
", but keep the comments that are present between these lines.
So, the desired output should appear as below:
Windows user
# I like it
# I want to keep these two lines
New to Mac
Please help!
#EOF
I used sed
command to delete the range of lines using the line numbers
sed '2,7d' file
But this command deletes the comments as well, which I want preserved.