Ok, try this perl script: #! /usr/bin/perl $joke=0; while(<>) { if(m/`....,..,/) { $joke=1;} if(m/^From .+\@.+/) { print "%\n" if ($joke); $joke=0; } print $_ if($joke); } print "%\n" if($joke);
save it to a file, turn on executable flag and use like this: cat archive inbox | fortunes.pl > fortunes.txt Cory On Wed, Jan 22, 2003 at 05:19:45PM -0800, Linux Rocks ! wrote: > On Wednesday 22 January 2003 01:24 pm, Cory Petkovsek wrote: > : Where is your email located? In an mbox? If so start with grep. Does > : the one liner have a particular format such as: > I have a couple files they could be in my inbox ( a text file named inbox), > and my archive file (named archive > I want the text between: > "???`????,??,????`???????`????,??,????`???????`????,??,????`???? > > The Famous Joke of the Day One Liner!" > > and from > > "From" > Heres a sample one, Infact, it would be nice to keep thier ascii art! and text > about where its from... like the example below... > > ???`????,??,????`???????`????,??,????`???????`????,??,????`???? > > The Famous Joke of the Day One Liner! > > Roses are red, Violets are blue. I'm Schizophrenic and so am I. > > The only consistant way I can tell its the end of the text is the From line in > the next message. > > so.... a cat inbox |grep > "???`????,??,????`???????`????,??,????`???????`????,??,????`???? > > The Famous Joke of the Day One Liner!" + any other text, untill you see > "From" >> joker > and it would also have to add a % after each instance. > > There is another problem... what if the one liner is "From joes book of > quotes" or something... it will cut that off!, so a better qualifier would > From *@* (ie anyone@anydomain) so it knows thats a new email. > > basic cat and grep im familiar with... but this is a bit more tricky that Ive > done.... > > Jamie > > > > : > : q: why did the chicken cross the road? because a penguin was chasing it > Thats a good quote! > > : > : You want a text file with no newlines or carriage returns, just % > : separating the jokes, right? > : > : On Wed, Jan 22, 2003 at 12:57:59PM -0800, Linux Rocks ! wrote: > : > So, Id like to extract just the one liner portion of email sent from > : > joker.org (ie, I want all the one-liners from all the memail joke of the > : > day messages I have, and a "%" to separate each oneliner, and Id like > : > them put in a text file, then I can make a fortune database with it, and > : > use it with fortune.) > : > > : > What would be the best way to do this? > : > > : > Jamie > : > > : > > : > -- > : > No microsoft products were used to produce this message. > : > EUG-LUG Mailing List: > : > http://mailman.efn.org/cgi-bin/listinfo/eug-lug > : > > : > _______________________________________________ > : > Eug-LUG mailing list > : > [EMAIL PROTECTED] > : > http://mailman.efn.org/cgi-bin/listinfo/eug-lug > : > : _______________________________________________ > : Eug-LUG mailing list > : [EMAIL PROTECTED] > : http://mailman.efn.org/cgi-bin/listinfo/eug-lug > > -- > No microsoft products were used to produce this message. > EUG-LUG Mailing List: > http://mailman.efn.org/cgi-bin/listinfo/eug-lug > > _______________________________________________ > Eug-LUG mailing list > [EMAIL PROTECTED] > http://mailman.efn.org/cgi-bin/listinfo/eug-lug _______________________________________________ Eug-LUG mailing list [EMAIL PROTECTED] http://mailman.efn.org/cgi-bin/listinfo/eug-lug