Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Sep 2017 20:34:28 +0200
From:      Polytropon <>
To:        Ernie Luzar <>
Cc:        "" <>
Subject:   Re: Is it possible to sort a key field right to left
Message-ID:  <>
In-Reply-To: <>
References:  <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Thu, 14 Sep 2017 11:07:40 -0400, Ernie Luzar wrote:
> I have a file containing a list of host domain names known to contain 
> viruses.
> I want to sort the host names from right to left so they are grouped 
> together by like host name suffixes.
> Is this possible?

Yes, easily, and provided by the OS. The "sort" command can do it.


	... | sort -t '.' +2 | ...

Use the -t parameter to define the field separator, and +N to
set the sorting field (+2 means to sort according to the 3rd
field, i. e., +N means "go to the right N fields").

See "man sort" for details.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

Want to link to this message? Use this URL: <>