When I mentioned your program, I meant the one for the joker-one liner, I guess I should have pasted it in... So.. here it is:
#! /usr/bin/perl #Cory Petkovsek <[EMAIL PROTECTED]> $art=" ¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø\n"; $delim=" The Famous Joke of the Day One Liner!"; $joke=0; while(<>) { if(m/$delim/) { print "$art\n"; $joke=1;} if(m/^From .+\@.+/) { print "%\n" if ($joke); $joke=0; } print $_ if($joke); } print "%\n" if($joke); This is for posting how to do stuff... so Im not trying to take credit for your program, but I aslo dont want to post your name/email address if you down want it on the web.... PS, I have a perl script that does the dos-unix text file conversion, it looks like: perl -pi.bak -e '\''s/\r//g;' yours is: perl -pi~ -e 's/\r\n/\n/g' it seems they are quite simular, but not exactly. Im guessing yours makes a tempfile <origfilename>~, mine does <origfilename>.bak then edits, and does about the same thing. what are the differences? the output seems the same. which is better? I was also thinking of putting your first sample program with the nice line by line explanation... is that ok? credits? Jamie Jamie On Thursday 30 January 2003 06:00 pm, Cory Petkovsek wrote: : This was a forward from someone in san diego. Don't put my name on it. : : It also only works in zsh, as the post said. : : Finally it is not a C solution to your joke problem. A one-liner is a : command that fits on one line that does something from the command prompt. : For instance here is a perl one liner that converts a dos text file to a : unix text file: : perl -pi~ -e 's/\r\n/\n/g' <file> : : This C one liner prints "Hi Mom!" to stdout. : : Cory : : > Cory, : > So.. this is interesting enough... I assume its a C solution to the : > strip the : > one-liners out of joker-mail... I'd give it a try, but Im unsure how to : > apply it to my situation... : > I was thinking of making up a couple webpages of nifty linux trix like : > the : > one-liner solution, May I have permission to include your program? : > Can/Should I add : > #Cory Petkovsek <[EMAIL PROTECTED]> : > To your solution? : > : > Jamie : > : > On Wednesday 29 January 2003 02:22 pm, Cory Petkovsek wrote: : > : Check this out: one-liners are possible in C! : > : > [jaqque@athena:~]% /lib/ld-linux.so.2 =( gcc -o /dev/stdout -xc <(echo : > '#include <stdio.h>';echo 'main(){printf ("Hi, Mom!\n");return 0;};') : > 2>&1 ) Hi, Mom! : > : > : > : > -- : > I'm telling you that the kernel is stable not because it's a kernel, but : > because I refuse to listen to arguments like this. : > -- Linus Torvalds : > : > _______________________________________________ : > 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 -- Let's call it an accidental feature. -- Larry Wall _______________________________________________ Eug-LUG mailing list [EMAIL PROTECTED] http://mailman.efn.org/cgi-bin/listinfo/eug-lug