From owner-freebsd-questions@FreeBSD.ORG Thu Aug 21 12:45:19 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 0F3C7106567B for ; Thu, 21 Aug 2008 12:45:19 +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 9F72B8FC13 for ; Thu, 21 Aug 2008 12:45:18 +0000 (UTC) (envelope-from steve@ibctech.ca) Received: (qmail 13257 invoked by uid 89); 21 Aug 2008 12:52:48 -0000 Received: from unknown (HELO ?IPv6:2607:f118::5?) (steve@ibctech.ca@2607:f118::5) by 2607:f118::b6 with ESMTPA; 21 Aug 2008 12:52:47 -0000 Message-ID: <48AD63B7.8090107@ibctech.ca> Date: Thu, 21 Aug 2008 08:46:47 -0400 From: Steve Bertrand User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: freebsd-questions@freebsd.org X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: 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 12:45:19 -0000 I'm frequently having to modify/convert email addresses from one format/domain to another. Usually, I slap together a quick Perl script to do this for me. I don't do it frequently enough to keep track which one of my scripts does this for me, so I'm continuously re-inventing the wheel. Some of the time, I use sed/awk to do this, but that usually requires a few passes over a few files. To put it plainly, can anyone, if it's possible, provide a single line sed/awk pipeline that can: - 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 Regards, Steve