Date: Thu, 21 Aug 2008 09:42:57 -0400 From: Steve Bertrand <steve@ibctech.ca> To: Anton Shterenlikht <mexas@bristol.ac.uk> Cc: freebsd-questions@freebsd.org Subject: Re: sed/awk, instead of Perl Message-ID: <48AD70E1.9040600@ibctech.ca> In-Reply-To: <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> <20080821133352.GA93561@mech-cluster238.men.bris.ac.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <inputfile> | awk '{print $1 "@example.com"}' > <outputfile> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48AD70E1.9040600>