Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Aug 2010 11:14:03 -0500
From:      Mark Tinguely <marktinguely@gmail.com>
To:        lconrad@Go2France.com
Cc:        freebsd-questions@freebsd.org
Subject:   Re: awk problem
Message-ID:  <4C656F4B.2070304@gmail.com>
In-Reply-To: <201008131723.AA679149726@mail.Go2France.com>
References:  <201008131723.AA679149726@mail.Go2France.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Len Conrad wrote:
> I readfile or pipe this text, in any line order:
>
> rm90.steampick.info
> fgce172.lanejive.info
> smailer1.service.govdelivery.com
> fl49.orangetalon.info
> pollux.carespecial.info
>
> into a program to remove subdomains down to domain.tld :
>
> awk 'FS="." { print $(NF-1)"."$NF }'
>
> and get the first line doubled rather than processed like the other lines:
>
> rm90.steampick.info.rm90.steampick.info
> lanejive.info
> govdelivery.com
> orangetalon.info
> carespecial.info
>
> thanks
> Len
>
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
>
>   

How about:

 awk -F. '{ print $(NF-1)"."$NF }'



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C656F4B.2070304>