David Oswald wrote:
> 
> Hello all ,
> 
>         I have a network of users here running NT and these users write 
> various
> files out to a Debian box running Samba. These files are then served up
> by an appache web server running on the same Debian machine.
> 
> 2 QUESTIONS:
> 
>         1) I need to remove the ^m found at the end of each file that is
> created by those rotten NT users. If in vi I issue a "%s/^M//g I do
> remove the ^m but the file system is becoming too large to do this by
> hand.
>         Can someone please assist me with a script that will enter the
> /var/www tree and search all *html files and then run a (sed
> script ?) that would do this for me without any user

If you'll settle for perl...

#!/usr/bin/perl

chdir('/var/www');
open(FL,'find . -type f -name "*.htm*" -print |') || die "can't find:
$!\n";
while($HTML = <FL>)
    { open(HTM,$HTML) || warn "couldn't process $HTML: $!\n", next;
    open(OUT,'>'.$HTML$$) || warn "can't write $HTML$$: $!\n", next;
    while(<HTM>) { s/\015$//; print OUT; };
    close(OUT); close(HTM);
    unlink($HTML);
    link($HTML$$,$HTML);
    unlink($HTML$$);
    };

That's off the top of my head with no perl to work with (I'm reading
this with Netscape on W95 since XFree86-3.3 blew my X service away). If
I were to do this for "real" I'd error chech all those link/unlink
thingies, but I suspect this will serve you well as-is.
> interaction. (I would run this process probably once a night
> in                                      a cron job.)
> 
>         I thought maybe this process would look something like:
>         " find /var/www -name "*html" -ls | awk '{print $11}' " so
> this         would generate a list of my files that need to be opperated
> on,         but I dont know  enough to complete the equation. Any
> assitance         greatly appreciated here... Thanx in advance...
> 
>         2) I also need to traverse the same /var/www directory and timestamp
> all files contained in it (regardless of file type). The complete
> /var/www directory actually gets archived for audit control. each file
> needs to be timestamped with the current time/date before its archival.
> Again I invision a find script doing this for me but I'm open to other
> suggestions on both of my issues described.
> 
> All help greatly appreciated...
> 
> --
> TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
> [EMAIL PROTECTED] .
> Trouble?  e-mail to [EMAIL PROTECTED] .


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .

Reply via email to