0

given a file formatted as markdown occasionally interspersed with blocks of PGP, how can I strip out the PGP blocks using standard linux tools in a shell script?

The file looks like this gist

(I had to create a gist because of formatting issues)

code_monk
  • 9,451
  • 2
  • 42
  • 41

1 Answers1

1

Using sed you can do that:

sed '/^-----BEGIN PGP/,/^-----END PGP/d' file

In short: you define a range of lines between two patterns /pat1/,/pat2/ that are deleted (d).

Casimir et Hippolyte
  • 88,009
  • 5
  • 94
  • 125