using sed command to delete a string spanning multiple lines

file1 contains the following data

sssssssssss
firstline
secondline pppppppppp
ssssssssss

Using sed comamnd i am trying to delete firtsline secondline.
so, output should be
sssssssssss
pppppppppp
ssssssssss

I tried in the following the way, but it is not working.
sed s/"firstline[\r\t]secondline"// file1

sed -e '/firstline/d' -e '/secondline/d' input_file

I Think this would delete the lines containing the pattern secondline. But the OP wanted to remove the pattern from the line.

I think you can use like

sed 's/.*line//g' file1
or

sed -e 's/firstline//g' -e 's/secondline//g' file1

i forgot to mention, the input file can be

sssssssssss
firstline secondline pppppppppp
ssssssssss
or
sssssssssss
firstline
secondline pppppppppp
ssssssssss

ie firtsline secondline can be on the same line or on different lines, and we should only delete only if we can find both firstline and secondline continueously. otherwise it should be retained

Input

$ >cat file1
sssssssssss
firstline
secondline pppppppppp
ssssssssss

sssssssssss
firstline secondline pppppppppp
ssssssssss

Output

$ > sed -e 's/firstline//g' -e 's/secondline//g' file1
sssssssssss

 pppppppppp
ssssssssss

sssssssssss
  pppppppppp
ssssssssss

By continuously what does that mean,

line after line

firstline
secondline

or within a same line

firstline secondline

Acccording to my requirement it should not delete third 'firstline' because there is no 'secondline' string after that. it should delete only if 'firstline secondline' comes contionusly. It can have \n in between.

bash-3.00$cat file1
hello
ssssssssss
firstline
secondline pppppppppp
ssssssssss

sssssssssss
firstline secondline pppppppppp
ssssssssss
firstline ssssssssssss

bash-3.00$ sed -e 's/firstline//g' -e 's/secondline//g' file1
ssssssssss

pppppppppp
ssssssssss

sssssssssss
pppppppppp
ssssssssss
ssssssssssss

bash-3.00$

line after line or within the same line, both are allowed

sed 's/firstline secondline//g' file1
#!/bin/ksh
typeset -i mCnt
mAsFirst='1'
mFirst='firstline'
mSecond='secondline'
mInpFile='Your_Input_file'
while read mLine
do
  if [ "${mAsFirst}" = '1' ]; then
    mAsFirst='N'
    mPrevLine=${mLine}
    continue
  fi
  mCnt=`echo ${mPrevLine} | egrep -c "${mFirst}.*${mSecond}"`
  if [ ${mCnt} -ne 0 ]; then
    mOutPrev=`echo ${mPrevLine} | sed -e "s/${mFirst}//" -e "s/${mSecond}//"`
    echo ${mOutPrev}
  else
    mCnt=`echo ${mPrevLine} | egrep -c "${mFirst}"`
    if [ ${mCnt} -ne 0 ]; then
      mCnt=`echo ${mLine} | egrep -c "${mSecond}"`
      if [ ${mCnt} -ne 0 ]; then
        mOutPrev=`echo ${mPrevLine} | sed "s/${mFirst}//"`
        echo ${mOutPrev}
        mOutCurr=`echo ${mLine} | sed "s/${mSecond}//"`
        echo ${mOutCurr}
        mAsFirst='1'
      else
        echo ${mPrevLine}
      fi
    else
      echo ${mPrevLine}
    fi
  fi
  mPrevLine=${mLine}
done < ${mInpFile}
if [ "${mAsFirst}" != '1' ]; then
  mCnt=`echo ${mPrevLine} | egrep -c "${mFirst}.*${mSecond}"`
  if [ ${mCnt} -ne 0 ]; then
    mOutPrev=`echo ${mPrevLine} | sed -e "s/${mFirst}//" -e "s/${mSecond}//"`
    echo ${mOutPrev}
  else
    echo ${mPrevLine}
  fi
fi