From owner-freebsd-questions@FreeBSD.ORG Thu Aug 21 22:31:06 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 D914F106569D for ; Thu, 21 Aug 2008 22:31:06 +0000 (UTC) (envelope-from walt@wump.org) Received: from mta11.charter.net (mta11.charter.net [216.33.127.80]) by mx1.freebsd.org (Postfix) with ESMTP id 6D3908FC13 for ; Thu, 21 Aug 2008 22:31:06 +0000 (UTC) (envelope-from walt@wump.org) Received: from aarprv06.charter.net ([10.20.200.76]) by mta11.charter.net (InterMail vM.7.08.03.00 201-2186-126-20070710) with ESMTP id <20080821223105.RTGR21239.mta11.charter.net@aarprv06.charter.net>; Thu, 21 Aug 2008 18:31:05 -0400 Received: from [10.0.0.10] (really [68.116.98.9]) by aarprv06.charter.net with ESMTP id <20080821223105.JZSU29012.aarprv06.charter.net@[10.0.0.10]>; Thu, 21 Aug 2008 18:31:05 -0400 Mime-Version: 1.0 Message-Id: In-Reply-To: <48AD63B7.8090107@ibctech.ca> References: <48AD63B7.8090107@ibctech.ca> Date: Thu, 21 Aug 2008 15:30:57 -0700 To: Steve Bertrand , freebsd-questions@freebsd.org From: Walt Pawley Content-Type: text/plain; charset="us-ascii" X-Chzlrs: 0 Cc: 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 22:31:06 -0000 At 8:46 AM -0400 8/21/08, Steve Bertrand wrote: >- read email addresses from a file in the format: > >user.name TAB domain.tld > >- convert it to: > >user_name@example.com > >- write it back to either a new file, the original file, or to STDOUT I'm curious why Perl isn't a decent choice. I think I'd do something like perl -pe 's/(.*?)\.(.*)\t.*/$1_$2@example.com/' input_file > output_file Of course one could choose to actually run the output to the input with appropriate Perl options but I don't normally do that. -- Walter M. Pawley Wump Research & Company 676 River Bend Road, Roseburg, OR 97470 541-672-8975