From owner-freebsd-questions@FreeBSD.ORG Thu Aug 21 13:41:29 2008 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 35403106568D for ; Thu, 21 Aug 2008 13:41:29 +0000 (UTC) (envelope-from steve@ibctech.ca) Received: from ibctech.ca (v6.ibctech.ca [IPv6:2607:f118::b6]) by mx1.freebsd.org (Postfix) with SMTP id BD3FA8FC0A for ; Thu, 21 Aug 2008 13:41:28 +0000 (UTC) (envelope-from steve@ibctech.ca) Received: (qmail 15571 invoked by uid 89); 21 Aug 2008 13:48:58 -0000 Received: from unknown (HELO ?IPv6:2607:f118::5?) (steve@ibctech.ca@2607:f118::5) by 2607:f118::b6 with ESMTPA; 21 Aug 2008 13:48:58 -0000 Message-ID: <48AD70E1.9040600@ibctech.ca> Date: Thu, 21 Aug 2008 09:42:57 -0400 From: Steve Bertrand User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Anton Shterenlikht References: <48AD63B7.8090107@ibctech.ca> <20080821055429.A26910@eskimo.com> <20080821151330.E7822@wojtek.tensor.gdynia.pl> <48AD6AF7.7070209@ibctech.ca> <20080821133352.GA93561@mech-cluster238.men.bris.ac.uk> In-Reply-To: <20080821133352.GA93561@mech-cluster238.men.bris.ac.uk> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: sed/awk, instead of Perl X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Aug 2008 13:41:29 -0000 Anton Shterenlikht wrote: > On Thu, Aug 21, 2008 at 09:17:43AM -0400, Steve Bertrand wrote: >> Wojciech Puchar wrote: >>>> Try the following: >>>> >>>> >>>> cat t.txt | awk -F\t '{split($1, arr, "."); printf("%s_%s@%s\n", arr[ >>>> 1], arr[2], $2);}' > > a shorter way: > > sed s/\\./_/g | awk '{print $1 "@example.com"}' > Nice! Although Joseph's line works perfectly, your sed method is much more inline with the way I'm used to using things, and I'll remember it easier without having to review notes next time ;) Thanks, Steve