Re: [OT] Sed issue

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

 



David G. Miller wrote:
> 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.

Skipping the first three lines isn't reliable as a PGP message may
contain more or less lines after the -----BEGIN PGP MESSAGE-----,
there might be no Hash: header, could be multiple Comment: headers,
etc.  It would work in the specific case Dan asked about though.

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
======================================================================
Victory is Mine!
    -- Stewie Griffin

Attachment: pgpkrwyyoPqEN.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