[SOLVED] An XARGS question

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

 



Thanks that works

Todd Zullinger wrote:
> Michael Yep wrote:
> >> That did not seem to work. Is this correct ?
> >>
> >> [root@localhost ~]# lastb -ai |fgrep "Jul 18" |awk '{print $10
> >> }'|sort|uniq|xargs grep -i {} /root/BLACKLIST
> >> grep: 222.234.108.77: No such file or directory
> >> grep: 83.15.73.34: No such file or directory
>
> The -i is misplaced in this example. You'd want to use it after xargs
> instead of after grep for it to do what you want. (Though you might
> also want to use -i with grep to have it search case-insensitively.)
>
> The xargs manpage states that the -i option is deprecated and you
> should use -I{} instead. The {} is a string, you can use what you
> wish as the string to the -I option, so a more readable example might
> be:
>
> ... | xargs -Iip grep ip blacklist
>
>
> -- 
> Michael Yep
> Development / Technical Operations
> RemoteLink, Inc.
> 26W161 Plank Rd
> Naperville, IL 60563-3422
> Website: www.remotelink.com
> Direct: 800-362-9446 x164
> Fax: 630-983-0364
> GPG Key 0x126439D9
>
> Your Link to Effective Business Communications!
> Specializing in telecommunications and Internet technology. If it
> helps connect you with your customers, remote employees and colleagues
> we do it. We put you in control of today’s technology. From
> Teleconferencing, WebConferencing, Auto Attendant and Broadcast
> messaging to Custom data collection, ecommerce, CTI and IVR services.
>


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux