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
Post a Comment