Re: Sed issue

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

 



On 01Dec2006 08:27, David G. Miller <dave@xxxxxxxxxxxxx> wrote:
| Why use sed?  How about:
| 
| cat file | head --lines=-3 | awk '{if (/-----BEGIN PGP SIGNATURE-----/) 
| exit; print $0;}'

You example is a prime reason to use sed! It is long, complex and runs
three programs!

You can replace "cat file | head --lines=-3" with:

  sed 1,3d

You can replace the entire awk command with:

  sed '/-----BEGIN PGP SIGNATURE-----/{d;q}'

You can replace your entire command pipeline with:

  sed '1,3d; /-----BEGIN PGP SIGNATURE-----/{d;q}'

And _that_ is why you'd use sed for this.
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

All my life, people have accused me of being stubborn, by which they meant
I was just standing there, when I could be taking their advice. - Adair Lara

-- 
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