0

I have over 1000 text files where I need to remove the first 6 lines and also remove some boilerplate text from the bottom of each file.

I am trying this in one command in sed, if possible.

Here are the individual commands

sed -i.bak '/Some text as starting delimiter/,/Some text as an ending delimiter/d' My-File.txt

sed -e '1,6d' < MyFile.txt

Can these be combined ?

How so?

Thanks

Slinky
  • 5,662
  • 14
  • 76
  • 130
  • Does this answer your question? [Combining two sed commands](https://stackoverflow.com/questions/7657647/combining-two-sed-commands) – tripleee May 02 '21 at 16:08

1 Answers1

1

Try this:

sed -i.bak -e '/Some text as starting delimiter/,/Some text as an ending delimiter/d' -e '1,6d' My-File.txt

or

sed -i.bak '/Some text as starting delimiter/,/Some text as an ending delimiter/d;1,6d' My-File.txt
Cyrus
  • 84,225
  • 14
  • 89
  • 153