[CS-FSLUG] shell script trivia

Frank Bax fbax at sympatico.ca
Fri Oct 15 12:52:42 CDT 2004


Perfect - thanks.  In the meantime I found out that php 4.3.8 has corrected 
problem, so upgrade will be planned soon.  I'm on 4.3.5RC3.


At 01:30 PM 10/15/04, Tim Young wrote:

>If you don't care what is on the first line (if you assume it is blank) you
>can:
>
>lynx -source http://domain.com/report.php?id=22|sed '1d'|sendmail-i -t
>
>where that is the number one in the sed script.  That just says to delete the
>first line.
>
>         - Tim
>
>Frank Bax wrote:
> >
> > At 11:46 AM 10/15/04, Josiah Ritchie wrote:
> >
> > >On Fri, 15 Oct 2004 09:59:58 -0400
> > >Frank Bax <fbax at sympatico.ca> wrote:
> > >
> > > > Sometime ago I wrote an application in php.  Shortly thereafter it was
> > > > decided that some of the reports should be emailed to users on a 
> regular
> > > > basis (a good job from cron).  The server wasn't configured to run php
> > > > from command line, so I used "lynx -source" to get the report out of
> > > > application and "attach" to an email message.  Because I wanted 
> some info
> > > > from database in the subject line, it was easier to modify the php
> > > > scripts to supply everything I needed (mail headers, mime headers) so
> > > > that I could simply pipe the lynx output to sendmail with:
> > > >       lynx -source http://domain.com/report.php?id=22 | sendmail -i -t
> > > > But the version of php on my recently upgraded server includes a blank
> > > > line at the beginning of file that wasn't there in old version and
> > > > sendmail is now complaining.  I know the problem isn't with lynx 
> because
> > > > running my script from old server to retrieve php report from new 
> server
> > > > also fails.
> > > >
> > > > Is there an existing command I can use to strip off that first line?
> > >
> > >Something like
> > >
> > >lynx -source http://domain.com/report.php?id=22|grep -v ^$|sendmail-i -t
> > >
> > >should work shouldn't it. Since it's HTML any other blank lines can be
> > >removed also. I tested it with this
> > >cat /etc/samba/smb.conf|grep -v ^$
> > >
> > >I use the command
> > >cat /etc/samba/smb.conf|grep -v ^$|grep -v ^#
> > >to clean up config files before I share them with others.
> >
> > Except that the records for mime attachments have some required blank 
> lines.
> >
> > _______________________________________________
> > ChristianSource FSLUG mailing list
> > Christiansource at ofb.biz
> > http://cs.uninetsolutions.com
>
>_______________________________________________
>ChristianSource FSLUG mailing list
>Christiansource at ofb.biz
>http://cs.uninetsolutions.com





More information about the Christiansource mailing list