From owner-freebsd-questions@FreeBSD.ORG Thu Aug 21 16:52:15 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 811D81065678 for ; Thu, 21 Aug 2008 16:52:15 +0000 (UTC) (envelope-from gerard@seibercom.net) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.242]) by mx1.freebsd.org (Postfix) with ESMTP id 32BD38FC18 for ; Thu, 21 Aug 2008 16:52:14 +0000 (UTC) (envelope-from gerard@seibercom.net) Received: by an-out-0708.google.com with SMTP id b33so13218ana.13 for ; Thu, 21 Aug 2008 09:52:14 -0700 (PDT) Received: by 10.100.132.2 with SMTP id f2mr2173563and.141.1219337534150; Thu, 21 Aug 2008 09:52:14 -0700 (PDT) Received: from scorpio ( [67.189.233.182]) by mx.google.com with ESMTPS id c27sm277408ana.37.2008.08.21.09.52.13 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 21 Aug 2008 09:52:13 -0700 (PDT) Date: Thu, 21 Aug 2008 12:52:07 -0400 From: Gerard To: freebsd-questions@freebsd.org Message-ID: <20080821125207.2ba8ef66@scorpio> In-Reply-To: <200808211349.m7LDnHHX000891@lurza.secnetix.de> References: <48AD63B7.8090107@ibctech.ca> <200808211349.m7LDnHHX000891@lurza.secnetix.de> Organization: seibercom.net X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; i386-portbld-freebsd6.3) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEX+/v7++v6YOTrq8PCcuIX989UvOSj++v0BNCbpAAAAB3RJTUUHsQwfFzs7RBhzUQAAAhJJREFUOI1dU8GOqzAMNKIoV1bvwD1i0ysqrHplIdBrVSX7ATSbd03VVvn9tQNtQy0hjAdn7LED4AAcPtWm9RV+MPSfxhBLx9ajd6X/ngB6/mTwnRSZua7i7Ca+0ctZKo4Qmz+JY13X6I3nFZBxIYW1PbgfQ5RP8g0XlltEWGf3cV03joYpRnFbvYDKbXjZlXyyhEZA4lI+cN3NaVXE4VKjSwTExO10eTEkkJVqIAD5z0nUBQJluQDRSQjcrBiHAJxZlAH5CUMBMC7OcJ4LMQNnxhZ1HYPscMc6J4UlWRMNwzOpCcAHKSICd1EDn83abdREIbXsHkD1OinP1aCUCOEVRaa1lMcvywUWdYgk13JQUpYNKmvXQ8Kw5ML9YI5h8SakctBc7E/IYuLhYd/zZIk+1gM1vNweQBvHE0j+oYah3sMqAytQYlZk6+ANaaawJdu3OFzYGMZ3iGpa3qMlq9ZH0VZTgrCtw/ngdYkEIIpSbP1bWQAdFdX9vocBdkH2qVjVmuMu3gI5rjs814EUdrCZgWlPaxZZ3RiLFUtr+ud0PXwp2dnQSNXgePt6AZpBj6UMJ7VQkzN4utVeaSW1Dhn/kblGrKeMvNGnzwX4zuEDarYz1KdPtR60Gul0Gued+515SJXhCsl+Tx/3kY/UDvicPll9mfu50t3tvQ/thZpJYgeuwdSKNJ6tCD98MCgoxLDaPxbwqqwPWaWiAAAAAElFTkSuQmCC X-Face: "\j?x](l|]4p?-1Bf@!wN<&p=$.}^k-HgL}cJKbQZ3r#Ar]\%U(#6}'?<3s7%(%(gxJxxcR nSNPNr*/^~StawWU9KDJ-CT0k$f#@t2^K&BS_f|?ZV/.7Q Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/eC+DiSxLuv0dhvGpUehkgT2"; protocol="application/pgp-signature"; micalg=PGP-SHA1 Subject: OT: Re: sed/awk, instead of Perl X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-questions@freebsd.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Aug 2008 16:52:15 -0000 --Sig_/eC+DiSxLuv0dhvGpUehkgT2 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Thu, 21 Aug 2008 15:49:17 +0200 (CEST) Oliver Fromme wrote: > > To put it plainly, can anyone, if it's possible, provide a single > > line sed/awk pipeline that can: > >=20 > > - read email addresses from a file in the format: > >=20 > > user.name TAB domain.tld > >=20 > > - convert it to: > >=20 > > user_name@example.com =20 > >With awk(1): > > awk '{sub(/\./, "_", $1); print $1 "@example.com"}' > >With sed(1) (you have to replace "^T" with a real tab!): > > sed 's/^\(.*\)\.\(.*\)^T.*/\1_\2@example.com/' > >With tr(1) + sed(1): > > tr '.\t' '_@' | sed 's/@.*/@example.com/' > >Personally I like the last solution best, because it's >short and easy to understand. > >BTW, all of the above command read from stdin and write >to stdout, so you can use shell redirection to read from >a file and/or write to a file. There is no need to use >cat(1). It seems like we have all had fun picking on the use of 'cat'. I would like to close this discussion with something I learned in school long ago. A big cat is a Lion, and a Lion is a dangerous animal. However, a little cat is a pussy, and a little pussy never hurt anyone. --=20 Gerard gerard@seibercom.net Technological progress has merely provided us with more efficient means for going backwards. Aldous Huxley --Sig_/eC+DiSxLuv0dhvGpUehkgT2 Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkitnTgACgkQ6DWTaTcTwMn43gCgyF5VqUGvfSgUYPwiUJOYn3vk 2MQAni1BoaNziKhIvUouhX6QafSTY3tB =hBUD -----END PGP SIGNATURE----- --Sig_/eC+DiSxLuv0dhvGpUehkgT2--