![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Getting latest file from ftp | arunavlp | UNIX for Dummies Questions & Answers | 3 | 02-08-2008 10:19 AM |
| How Can I Easily Determine If A File Has been Added to a Directory | goodmis | UNIX for Advanced & Expert Users | 7 | 02-04-2007 01:13 AM |
| How Can I Easily Determine If A File Has been Added to a Directory | goodmis | UNIX for Dummies Questions & Answers | 1 | 01-31-2007 06:56 PM |
| Moving part of Text in a file | mgirinath | Shell Programming and Scripting | 4 | 02-06-2006 06:04 PM |
| How to scan only new lines added in file? | redlotus72 | UNIX for Dummies Questions & Answers | 3 | 04-28-2005 04:34 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Get the latest added part of a text file?
Hi,
I want to get the latest added part of a text file sent over the network to for analysis. Is there a tool to use to keep track of which part of a text file that has already been analysed so only the "new" lines will be sent and handled? I have checked a few tools but I still don´t know how to solve this. Rsync seems to be able to copy the latest added content of a file in an "incremental way" but I don´t know how to take care of this "incremental content" in a script. Do you have any ideas? |
|
|||||
|
If the data is appended to the file, then perhaps...
(the following is a rough coding; there are issues with spacing and field layouts known) analyze data as normal wc -l mydatafile >mydatafile.last next time to analyze newcnt=$(wc -l mydatafile) lastcnt=$(cat mydatafile.last) newlines=$(echo $newcnt - $lastcnt | bc) now, a tail command could provide you with the last lines to review |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|