LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Possible to read just from a certain point in HTML document (logfile) (https://www.linuxquestions.org/questions/linux-newbie-8/possible-to-read-just-from-a-certain-point-in-html-document-logfile-921778/)

exallon 01-03-2012 08:50 AM

Possible to read just from a certain point in HTML document (logfile)
 
Hi

I am trying to find a way to read only the end of a txt file appended to by a webserver.

assume http://somesite.com/myfile.txt

data1
data2
..
data10

read full file

server adds data
Data x
Data y

I then want to continue from after data10 to minimize server load. Is there a way to do this?

Thanks!

lithos 01-03-2012 11:19 AM

Hi,

possible with awk, see examples from here
Code:

awk '/search_pattern/{f=1;next}f' file
or something like
Code:

cat /var/log/messages  | awk '/search_pattern/,0'

exallon 01-05-2012 02:23 AM

I don't have direct access to that server. So what I need to make happen is to make the webserver only send me the data that is new.

Otherwise I might as well just get the whole file over and over again. But this is to minimize server load since the file is growing over the day.

lithos 01-05-2012 04:50 AM

for that you will need a PHP or some script to get the file from server and show you only the lines you want.

I don't know if there is anything like that already on the internet,
because I assume that every time you want data from file, the last lines change so the search condition also changes from previous search.

Post a sample file with data to get more help (you can use pastebin and post a link to that file here.


All times are GMT -5. The time now is 11:10 AM.