Re: An XARGS question

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

 



On Tue, Jul 18, 2006 at 11:31:00PM +0200, Alexander Dalloz wrote:
> Even shorter:
> 
> lastb -ai | awk '/Jul 18/ {print $10}' | sort -u | fgrep -x -f - blacklist

Of course, in the way that I wrote it, if blacklist really only contains
IP addresses, and is not huge, then one should reverse the order:

	| fgrep -x -f blacklist

If blacklist is huge, and the output of the pipeline is not, or e.g., blacklist
has multiple fields, say IP address, reason for blacklisting, etc., and one
wants the whole record, then the order that I gave is useful.

To avoid false matches, one should either use -w, or put delimiters in the file,
and include them in the input patterns, e.g.,

lastb -ai | awk '/Jul 18/ {printf ":%s:\n", $10}' | sort -u | fgrep -f - blacklist

In really ugly situations, one wants to use (e)grep instead of fgrep, and one may
need to escape regex metacharacters like '.' in the input patterns.

Regards,

	Bill Rugolsky

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