From owner-freebsd-questions@FreeBSD.ORG Fri Aug 13 16:37:49 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3522106564A for ; Fri, 13 Aug 2010 16:37:49 +0000 (UTC) (envelope-from lconrad@Go2France.com) Received: from mgw1.MEIway.com (mgw1.meiway.com [81.255.84.75]) by mx1.freebsd.org (Postfix) with ESMTP id 6AA328FC13 for ; Fri, 13 Aug 2010 16:37:49 +0000 (UTC) Received: from VirusGate.MEIway.com (virusgate.meiway.com [81.255.84.76]) by mgw1.MEIway.com (Postfix Relay Hub) with ESMTP id 2F968471875 for ; Fri, 13 Aug 2010 18:37:51 +0200 (CEST) Received: from mail.Go2France.com (ms1.meiway.com [81.255.84.73]) by VirusGate.MEIway.com (Postfix) with ESMTP id 8F6A23865BA for ; Fri, 13 Aug 2010 18:37:51 +0200 (CEST) (envelope-from lconrad@Go2France.com) Date: Fri, 13 Aug 2010 18:37:49 +0200 Message-Id: <201008131837.AA400228682@mail.Go2France.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii From: "Len Conrad" X-Sender: To: X-Mailer: Subject: Re: awk problem X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: lconrad@Go2France.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 16:37:49 -0000 ---------- Original Message ---------------------------------- From: Mark Tinguely Date: Fri, 13 Aug 2010 11:14:03 -0500 >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 }' that works, thanks Len