Re: [OT] Sed issue

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

 



"Dan Track" <dan.track@xxxxxxxxx> 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.

At the top of the file I have:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message


And at the bottom I have
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFcCjc3ONEHVs4u3gRAj4QAJ0V3ty8JTq4nMBORezYNIY5w3lS0QCfaktf
zdJZhBHnGdrGYYIzIVvUxHO=
=3RVS
-----END PGP SIGNATURE-----

Why use sed?  How about:

cat file | head --lines=-3 | awk '{if (/-----BEGIN PGP SIGNATURE-----/) exit; print $0;}'

The head --lines=-3 prints the file after skipping the first three lines. The little awk program prints everything until it gets to the PGP signature line.

Cheers,
Dave

--
Politics, n. Strife of interests masquerading as a contest of principles.
-- Ambrose Bierce


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

  Powered by Linux