"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
--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list