Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Aug 2008 14:33:52 +0100
From:      Anton Shterenlikht <mexas@bristol.ac.uk>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: sed/awk, instead of Perl
Message-ID:  <20080821133352.GA93561@mech-cluster238.men.bris.ac.uk>
In-Reply-To: <48AD6AF7.7070209@ibctech.ca>
References:  <48AD63B7.8090107@ibctech.ca> <20080821055429.A26910@eskimo.com> <20080821151330.E7822@wojtek.tensor.gdynia.pl> <48AD6AF7.7070209@ibctech.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <inputfile> | awk '{print $1 "@example.com"}' > <outputfile>

-- 
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



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