Re: [OT] Sed issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dan Track wrote:
> I'm hoping one of you experts out there can help me. I'd like to
> delete a file signiture from the top and bottom of a file. I know I
> need to use sed, but my sed isn't that good. Could someone please
> help me write a sed command. I would appreciate any help.

Something like this should do the trick:

$ sed '/^-----BEGIN PGP SIGNED MESSAGE-----$/,/^$/ d; /^-----BEGIN PGP SIGNATURE-----$/,/^-----END PGP SIGNATURE-----$/ d'

This command uses pattern matching to define the range and then uses
the d command to delete that range.  (I'm looking forward to seeing
other ways to do it. :)

I notice that the PGP message has a NotDashEscaped: armor header.
This is typically used for patch files to allow the patch program to
parse the output properly and yet still be verifiable with PGP/GnuPG.
If that's what you have, perhaps you don't need to remove the PGP info
at all?

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
======================================================================
The history of liberty is a history of resistance.
    -- Woodrow Wilson

Attachment: pgpRVVcGxxEju.pgp
Description: PGP signature


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux