我有一个如下所示的CSV文件:
Group1;Email address of group1;
Item1 of group1;
Item2 of group1;
Group2;Email address of group2;
Item1 of group2;
Item2 of group2;
Item3 of group2;
我想编写一个发送这样的电子邮件的bash脚本:
To: email address of group(n)
Message: Item1 of group(n)
Item2 of group(n)
我被告知我应该使用awk,但我不知道如何将循环与awk结合使用,以便将这些项目放入电子邮件正文中。有大约150个团体。
示例输入:
DC.EWS;alice.blue@company.com;
Hdfhjsf;
Ddshugds;
Sccbcbcjs;
Eweq-dhhda;
CCC.DGAA;bob.green@company.com;
Ssdf-sdhwq sdhaa;
Fdsjjew.sdhah;
Xsdjasdhdsf;
示例输出:
发送电子邮件至alice.blue@company.com:
Hi!
Do you have the source for these items?
Hdfhjsf
Ddshugds
Sccbcbcjs
Eweq-dhhda
Thanks.
电邮至bob.green@company.com:
Hi!
Do you have the source for these items?
Ssdf-sdhwq sdhaa
Fdsjjew.sdhah
Xsdjasdhdsf
Thanks.