I have the following text..
[start]
this
is my line
[end]
My output should be:
this
is my line
Need help..
Tried a combination of :
sed -n '/start/,/end/p' $File & sed -e "s/]/']/" -e "s/\[/['/" $file
but it brings up the pattern too.
I have the following text..
[start]
this
is my line
[end]
My output should be:
this
is my line
Need help..
Tried a combination of :
sed -n '/start/,/end/p' $File & sed -e "s/]/']/" -e "s/\[/['/" $file
but it brings up the pattern too.
You can remove the first and last line with
$ sed '1d;$d'
So of your input file just include the text you've shown you are done. If you need to find the part between [start] and [end] do it like this:
$ sed -n '/start/,/end/p' $File | sed '1d;$d'
Does this satisfy your requirement?
sed -n '/^[start]/,/[end]/p'
The equivalent to the above is:
sed '/^[start]/,/[end]/!d'