[CS-FSLUG] shell script trivia

Josiah Ritchie jritchie at bible.edu
Fri Oct 15 10:46:43 CDT 2004


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.

JSR/




More information about the Christiansource mailing list