[nycbug-talk] fun one liners
Ray Lai
nycbug at cyth.net
Thu Jun 8 17:14:30 EDT 2006
On Thu, Jun 08, 2006 at 03:28:24PM -0400, Anthony Elizondo wrote:
> On 6/8/06, Pete Wright <pete at nomadlogic.org> wrote:
> > although one guy posted this:
> > % fstat | grep 'httpd.*/var ' | awk '{print $6}' | xargs -n 1 sudo find \
> > -x /var -inum | sort -u
>
> That is indeed awesome. Although, you could optimize it by moving the
> sort after the awk, since it looks like httpd has lots of different
> pids accessing the same inode. I'm squirreling it away.
>
> Given a ip1.txt, a text file that has a list of ip addresses in it,
> the following will put them in order:
>
> awk -F. '{print $1*65536+$2*256+$3 " " $0}' ip1.txt | sort -n | cut -f
> 2- -d ' ' > sorted.txt
>
> Stolen from: http://articles.involution.com/clguide.html
Or:
$ sort -t. -nk1,1 -k2,2 -k3,3 -k4,4 /tmp/random.ips
-Ray-
More information about the talk
mailing list