email contents parsing get email adress on shell script -
in folder asdasdasd.msg asdasd.msg twadasf.msg ... ... ...
*.msg file sample email contents =>
date: wed, 03 aug 2011 11:20:59 +0300 (eest) from: email account name =?utf-8?b?r8octkrpxj5evq==?= <emailname@sample.com> to: different email account name <different@sample.com> subject: re: web anketi message-id: <d6d75689-bfde-451d-8a91-0da4d4e8921e@posta.sample.com> in-reply-to: <4ac9813a-4511-4530-b098-62fd23ecdb5b@posta.sample.com> content-type: text/plain; charset=utf-8 content-transfer-encoding: quoted-printable mime-version: 1.0 x-originating-ip: [10.199.16.77] ....
run.sh script:
line in `sed 's/\(<\)\(.*\)\(@sample.com>\)/\2/'` *.msg echo $line done
my problem email adress list <@sample.com> ? email adress array list ?*
using bash loop read *.msg files. sed -n
suppresses output of non-matches pattern. p
flag @ end of sed command prints out substituted text.
for file in *.msg sed -n 's/^.*\(<\)\(.*\)\(@posta.sample.com>\)/\2/p' $file done
Comments
Post a Comment