awk problem

Mark Tinguely marktinguely at gmail.com
Fri Aug 13 16:37:19 UTC 2010


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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>
>   

How about:

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


More information about the freebsd-questions mailing list