sed/awk, instead of Perl

Steve Bertrand steve at ibctech.ca
Thu Aug 21 13:00:49 UTC 2008


Joseph Olatt wrote:

> Try the following:
> 
> 
>  cat t.txt | awk -F\t '{split($1, arr, "."); printf("%s_%s@%s\n", arr[
> 1], arr[2], $2);}'
> 
> where t.txt:
> john.doe    example.com

This did the job, the only modification I needed to make was manually 
replace $2 with the string of the domain I needed it changed to.

Fantastic!

Thanks everyone for such quick responses!

Steve


More information about the freebsd-questions mailing list