miscellaneous_tips:20_software_development:let_diff_ignore_certain_text_lines

When an ICS file is downloaded repeatedly from a CALDAV server, e.g. using wget or curl, then the DTSTAMP property in each VEVENT is likely to be set zo the current download date, even though the events themselves haven't changed. So a simple diff against a previous version of the file might yield lots of differences even though no event has really changed.

To ignore the DTSTAMP-only changes diff can be called to ignore all lines starting with DTSTAMP: when comparing the newly downloaded file to an older version of the same file:

diff -Naur -I ^DTSTAMP:.* file_new.ics file_old.ics; echo \$?

The example above also prints the return code from diff which could be evaluated in a scipt to check if further actions are required, or not.

Martin Burnicki martin.burnicki@burnicki.net 2019-03-06

• miscellaneous_tips/20_software_development/let_diff_ignore_certain_text_lines.txt
• Zuletzt geändert: 2021-08-27 10:43
• von martin