On Sat, Oct 14, 2000 at 09:36:37PM -0400, kf wrote:
Hi Ken,
Thank you very much for your input.
I tried you script with sed like this.
#!/bin/bash
cd /var/qmail/alias/pppdir.footer/new/ # go where files are
for ff in ./*.narada.col7.metta.lk # select files
do
# cludge for just finding the first instance of this string
sed 's/^----=_NextPart/----=_NextPart/'
# insert footer1
sed 's/^----=_NextPart/$footer1\n/----=_NextPart/r'
#insert footer 2
sed 's/\<\/BODY\>\<\/HTML\>/$footer2\n/\<\/BODY\>\<\/HTML\>/r'
done
The script hang up on the first line.
[root@narada /root]#ps -ax
22072 tty2 S 0:00 bash ./footer5
22073 tty2 S 0:00 sed s/^----=_NextPart/----=_NextPart/
22075 tty1 R 0:00 ps -ax
I had to ^C to break the process.
I also see a problem in that the constant "----=_NextPart"
is not really a constant but a variable
as the boundary sometimes does not always contain the string
"----=_NextPart"
but just an array of numbers and letters.
If one is to use sed
I suppose one first will have to find
boundary=
and next find what the boundary is
boundary=" whatever is between this "
This varies a lot. Here is one example.
"----=_NextPart_000_0120_01C033AD.8D13AE90"
and here is another example
"------------B6FA75717B16199DE3ACD837"
One would also have to take into consideration that if "boundary=" is not
found then it is a text file and would need to have a "text footer" at the
end.
> = Outlook first defines boundary. (this is different in each message)
> = boundary="----=_NextPart_000_0120_01C033AD.8D13AE90"
> = ----=_NextPart_000_0120_01C033AD.8D13AE90
> = message in text format
> = ----=_NextPart_000_0120_01C033AD.8D13AE90
> = message in html format.
> = </BODY></HTML>
> = ----=_NextPart_000_0120_01C033AD.8D13AE90--
> = I need to add my footer to 2 places as shown below
> =
> = boundary="----=_NextPart_000_0120_01C033AD.8D13AE90"
> = ----=_NextPart_000_0120_01C033AD.8D13AE90
> = message in text format
> = footer 1
> = ----=_NextPart_000_0120_01C033AD.8D13AE90
> = message in html format
> = footer 2
> = </BODY></HTML>
> = ----=_NextPart_000_0120_01C033AD.8D13AE90--
> =
> = (the last -- indicates end of message)
> = ...
> Looks to me like a job for sed, something like
> for ff in $file_descript
> do
> # cludge for just finding the first instance of this string
> sed 's/^----=_NextPart/----=_NextPart/'
> # insert footer1
> sed 's/^----=_NextPart/$footer1\n/----=_NextPart/r'
> #insert footer 2
> sed 's/\<\/BODY\>\<\/HTML\>/$footer2\n/\<\/BODY\>\<\/HTML\>/r'
> done
> If it were me and I had fewer than a couple hundred files to work this on,
> I would write a macro in emacs to do it unless it were just for the pure
> enjoyment of it.
I have to set up an ongoing process of adding footers to outgoing mail.
> Personally, there's too much other stuff in my life that
> comes before personal enjoyment.
I do not live off this but it is rather for me a side line of running
a free pop server for mail in Sri Lanka. So one could say that
this is only for personal enjoyment.
Unfortunately I do not have the full knowledge to do this and have over
the last year depended on the know-how I have been able to get from 3 or
4 mailing lists. People help me and I help others. It goes on.
Thanks for your help.
Jacob
(Bhikkhu Mettavihari)
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list