linux - How to print difference between two files -


i have 1 file data gets added every 10 min, want updated data can stored in new file(inc1.txt) through script.

my path file /home/asda/desktop/inc.txt

how can achive?

use tac cat file backwards, , quit when marker:

tac /home/asda/desktop/inc.txt | sed /marker/q | tac  

then add new marker @ end remember last finished

echo "marker" >> /home/asda/desktop/inc.txt  

this has disadvantage alters file, can grep out markers when use file this:

grep -v marker /home/asda/desktop/inc.txt 

of course, should make marker doesn't naturally occur in file.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -