shell - Replacing domains of e-mail addresses with just one domain -
i edit file containing set of email ids such domain names become generic.
example, peter@yahoo.com, julie@hotmail.com, philip@gmail.com peter@generic.com, julie@generic.com, philip@generic.com i used following sed command,
sed '/@/,/.com/ s//generic/' filename.txt here sed replaces '@' 'generic , .com 'generic' , not content in between @ , .com
use
sed 's/@[^,]*/@generic.com/' this replace after "@" until first comma generic.com, thereby fixing domain, , leaving ending comma in tact.
since seem have confusion, ranges (/regex/,/otherregex/) select number of lines, not positions within line.
Comments
Post a Comment