parsing email headers is a complex beast. If you know how some Perl, you can try this http://search.cpan.org/~rjbs/Email-Folder-0.855/lib/Email/Folder.pm
From: Noel Martin Llevares <noelmartin@...>
To: ce-gnu-lug@yahoogroups.com
Sent: Thursday, January 26, 2012 3:31 PM
Subject: Re: [ce-gnu-lug] Bash Script Help
Actually making a script to parse *.eml files and extract the From: and To: headers but it turns out some email headers have their names enclosed in quotes like "Noel Martin Llevares" <noelmartin@...> but some doesn't have. I'm having a hard time making a generalized parser.
Right now, I'm thinking at looking for Python or Perl modules that can do that. I'm looking at http://www.chilkatsoft.com/python.asp right now.
Noel
Right now, I'm thinking at looking for Python or Perl modules that can do that. I'm looking at http://www.chilkatsoft.com/python.asp right now.
Noel
On Thu, Jan 26, 2012 at 3:19 PM, Simon Cornelius P. Umacob <soulfury@...> wrote:
Hi Noel,
What exactly are you trying to do?
[ simon.cpu ]
------------------------------------
On Thursday, 26 January, 2012 03:12 PM, Noel Martin Llevares wrote:
>
>
> Hi everyone,
>
> I have been trying to google this specific problem for hours already but
> I still can't get this right. It's about string processing in the linux
> terminal using grep, sed, awk, bash, etc.
>
> The string in question is like this:
>
> The "quick brown" fox
>
> jumped over
>
>
> The 2nd and 3rd words in the first line are enclosed in quotes. But for
> some lines there are only two words. I need to read each line and parse
> the 2 or 3 words so that I can use them as parameters for awk.
>
> I wanted the results for the first line to be like $1=The, $2="quick
> brown", and $3=fox. But for the second line, $1=jumped, $2=, $3=over. If
> the phrase in quotes is missing, $2 should be blank.
>
> I would appreciate if someone could point me to some pointers. I have
> been grappling with grep, sed and awk for hours now and I still couldn't
> get it.
>
> Any help would be appreciated. Thanks.
>
> Noel
>
To Post a message, send it to: ce-gnu-lug@yahoogroups.com
To Unsubscribe, send a blank message to: ce-gnu-lug-unsubscribe@yahoogroups.com
Visit our website at: http://www.cegnulug.orgYahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ce-gnu-lug/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ce-gnu-lug/join
(Yahoo! ID required)
<*> To change settings via email:
ce-gnu-lug-digest@yahoogroups.com
ce-gnu-lug-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
ce-gnu-lug-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/