[OT] Sed issue

Todd Zullinger tmz at pobox.com
Fri Dec 1 15:06:22 UTC 2006


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 545 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20061201/d70b2b8f/attachment-0001.sig>


More information about the fedora-list mailing list