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

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux