Well, I think the simplest solution would be to filter out these lines from the first file. For example, you can do this using the following awk script:
# if line contains 'Directory created', just skip it.
/Directory created/ {
had_dir = ""
next
}
# if line contains sole 'Directory', store it and lookup next line.
/Directory/ {
had_dir = $0
next
}
# if line contains sole 'created' and we stored a line (which means
# it contained 'Directory'), then delete the stored one and skip
# (effectively, skip both).
/created/ && had_dir {
had_dir = ""
next
}
# otherwise, if we stored a line, print it.
had_dir {
print had_dir
had_dir = ""
}
# and print the current line.
{
print
}
If your input is more complex, you may need to adjust the regexes a bit.
Then, use the script to filter out first file:
$ awk -f script.awk file1 | diff - file2
0a1
> INFO : reuse temp1
Note that you're passing -
as first argument to diff
, to make it read the piped output of awk
instead of the file.
And also note that the line offsets will no longer be correct.