On Thu, 21 Aug 2008 15:49:17 +0200 (CEST) Oliver Fromme <[EMAIL PROTECTED]> wrote:
> > 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: > > > > [EMAIL PROTECTED] > >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.*/[EMAIL PROTECTED]/' > >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. -- Gerard [EMAIL PROTECTED] Technological progress has merely provided us with more efficient means for going backwards. Aldous Huxley
signature.asc
Description: PGP signature