[Gllug] printing and splitting IPs

Tethys . tethys at gmail.com
Wed Sep 28 14:08:08 UTC 2011


On Wed, Sep 28, 2011 at 2:39 PM, dudes dudes <akam123 at hotmail.co.uk> wrote:

> I've got a file with IPs and port numbers. I'm trying to split this file
> into different separate files based on the IP addresses and associate port
> numbers to file1, file2, file(n+1.) I'm issuing this statement, but it
> failed.
>
>  awk '/^*.*.*.*/{close("file"f);f++}{print $0 > "file"f}' file

You're using a glob pattern, where awk requires regular expressions.
Change it to:

	awk '/^.*\..*\..*\..*/{close("file"f);f++}{print $0 > "file"f}' file

Tet

-- 
"Java is a DSL for taking large XML files and converting them to stack
traces" -- Bulat Shakirzyanov
--
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list