unix - parse an email message for sender name in bash -


I have several files in one folder and each one of them has an email message, each message has a header in the format < / P>

Topic: Formatting Fonts
To: help@abc.com
Sender: Sender Name

Message Body

I want to get all unique sender names from all messages (only 1 message per file) How can I do this?

Assume that there can not be random headers in the middle of messages, then this should do the trick: / P>

  cat * | From Grep '^:' | If you can have other "scrappy" lines in the middle of the message, then you need to make sure that you are getting the first match line only from each message. , Such as:   for  in F *; Cat $ f | From Grep '^:' | Head-1 Sort-U;  

You may change * with a different order or in the list of file names.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -