Convert text to HTML - BSD

This is a discussion on Convert text to HTML - BSD ; Hi All, Firstly this is what I am setting out to do. I have a background script I wrote (I'm not very good with scripts at all). The script runs tcpdump -n -e -ttt -r /var/log/pflog >pflog.txt then sleeps for ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Convert text to HTML

  1. Convert text to HTML

    Hi All,

    Firstly this is what I am setting out to do.

    I have a background script I wrote (I'm not very good with scripts at
    all). The script runs tcpdump -n -e -ttt -r /var/log/pflog >pflog.txt
    then sleeps for 30 seconds, then repeats the same command.

    What I want to do, is somehow convert the data in pflog.txt into a HTML
    page that refreshes every 60 seconds or so, so I can watch it in a web
    browser. I'd probably want to tail -n 50 the data in the text file
    before converting it because there will be a lot of output

    I have apache on a diff box on my LAN, I can use wget to get pflog.txt
    from the original machine, over to the machine running apache.. My issue
    is with converting the text data.

    Any clues or suggestions/urls?

    I'm not afraid to RTFM, but which manuals to I need to read?

    Thanks!!
    Alex

  2. Re: Convert text to HTML

    alex wrote:

    > Firstly this is what I am setting out to do.
    > I have a background script I wrote (I'm not very good with scripts at
    > all). The script runs tcpdump -n -e -ttt -r /var/log/pflog >pflog.txt
    > then sleeps for 30 seconds, then repeats the same command.
    > What I want to do, is somehow convert the data in pflog.txt into a HTML
    > page that refreshes every 60 seconds or so, so I can watch it in a web
    > browser. I'd probably want to tail -n 50 the data in the text file before
    > converting it because there will be a lot of output
    > I have apache on a diff box on my LAN, I can use wget to get pflog.txt
    > from the original machine, over to the machine running apache.. My issue
    > is with converting the text data.
    > Any clues or suggestions/urls?
    > I'm not afraid to RTFM, but which manuals to I need to read?


    Here is an example which should explain everything. The example assumes that
    /var/log/pflog is readable for the webserver user.

    #!/bin/sh

    echo "Content-type: text/html"
    echo
    echo ""
    echo ""
    echo "pf log"
    echo ""
    echo ''
    echo ""
    tcpdump -n -e -tttt -r /var/log/pflog | tail -n 50 | while read line; do
    echo "$line
    "; done
    echo ""

    HTH, Helmut

    --
    No Swen today, my love has gone away
    My mailbox stands for lorn, a symbol of the dawn


  3. Re: Convert text to HTML

    Helmut Schneider wrote:
    > #!/bin/sh
    >
    > echo "Content-type: text/html"
    > echo
    > echo ""
    > echo ""
    > echo "pf log"
    > echo ""
    > echo ''
    > echo ""
    > tcpdump -n -e -tttt -r /var/log/pflog | tail -n 50 | while read line; do
    > echo "$line
    "; done
    > echo ""
    >
    > HTH, Helmut


    This should help enormously :-) Thank you!!!

    I did make an attempt of my own, but it didn't go quite to plan, I
    couldn't figure out a way to get the
    on the end of each line in the
    text file.

    Cheers,
    Alex

  4. Re: Convert text to HTML

    alex wrote:
    > Helmut Schneider wrote:
    >> #!/bin/sh
    >>
    >> echo "Content-type: text/html"
    >> echo
    >> echo ""
    >> echo ""
    >> echo "pf log"
    >> echo " "
    >> echo ''
    >> echo ""
    >> tcpdump -n -e -tttt -r /var/log/pflog | tail -n 50 | while read line; do
    >> echo "$line
    "; done
    >> echo ""
    >>
    >> HTH, Helmut

    >
    > This should help enormously :-) Thank you!!!
    >
    > I did make an attempt of my own, but it didn't go quite to plan, I
    > couldn't figure out a way to get the
    on the end of each line in the
    > text file.
    >
    > Cheers,
    > Alex


    Not necessary.

    Use instead,



    ....



  5. Re: Convert text to HTML

    YANSWBVCG wrote:
    > Not necessary.
    >
    > Use instead,
    >
    >
    >

    > ...
    >

    >


    Sweet, I'll take a look at this :-)

    Thanks!

+ Reply to Thread