From owner-freebsd-questions@FreeBSD.ORG Thu Aug 21 13:33:59 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 7CBAC1065671 for ; Thu, 21 Aug 2008 13:33:59 +0000 (UTC) (envelope-from mexas@bristol.ac.uk) Received: from dirj.bris.ac.uk (dirj.bris.ac.uk [137.222.10.78]) by mx1.freebsd.org (Postfix) with ESMTP id 38E058FC14 for ; Thu, 21 Aug 2008 13:33:59 +0000 (UTC) (envelope-from mexas@bristol.ac.uk) Received: from isis.bris.ac.uk ([137.222.10.63]) by dirj.bris.ac.uk with esmtp (Exim 4.69) (envelope-from ) id 1KWAIV-00079D-Dt for freebsd-questions@freebsd.org; Thu, 21 Aug 2008 14:33:57 +0100 Received: from mech-cluster238.men.bris.ac.uk ([137.222.187.238]) by isis.bris.ac.uk with esmtp (Exim 4.67) (envelope-from ) id 1KWAIU-0005cT-4j for freebsd-questions@freebsd.org; Thu, 21 Aug 2008 14:33:54 +0100 Received: from mech-cluster238.men.bris.ac.uk (localhost.men.bris.ac.uk [127.0.0.1]) by mech-cluster238.men.bris.ac.uk (8.14.2/8.14.2) with ESMTP id m7LDXrtp093589 for ; Thu, 21 Aug 2008 14:33:53 +0100 (BST) (envelope-from mexas@bristol.ac.uk) Received: (from mexas@localhost) by mech-cluster238.men.bris.ac.uk (8.14.2/8.14.2/Submit) id m7LDXrix093588 for freebsd-questions@freebsd.org; Thu, 21 Aug 2008 14:33:53 +0100 (BST) (envelope-from mexas@bristol.ac.uk) X-Authentication-Warning: mech-cluster238.men.bris.ac.uk: mexas set sender to mexas@bristol.ac.uk using -f Date: Thu, 21 Aug 2008 14:33:52 +0100 From: Anton Shterenlikht Cc: freebsd-questions@freebsd.org Message-ID: <20080821133352.GA93561@mech-cluster238.men.bris.ac.uk> References: <48AD63B7.8090107@ibctech.ca> <20080821055429.A26910@eskimo.com> <20080821151330.E7822@wojtek.tensor.gdynia.pl> <48AD6AF7.7070209@ibctech.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <48AD6AF7.7070209@ibctech.ca> User-Agent: Mutt/1.5.18 (2008-05-17) X-Spam-Score: -0.6 X-Spam-Level: / 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:33:59 -0000 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"}' > -- Anton Shterenlikht Room 2.6, Queen's Building Mech Eng Dept Bristol University University Walk, Bristol BS8 1TR, UK Tel: +44 (0)117 928 8233 Fax: +44 (0)117 929 4423