I need to make a list of files bigger than 10G that will be the ignorefile input for a duply backup. However, I have some files which I don't have permissions to read. I want to ignore those that will be handled later and make the list clean with out the 'Permission denied' message.
I can make the list like this:
$ find data/ -size +10G /data/bigfile1 find: `/data/badfile1': Permission denied find: `/data/badfile2': Permission denied /data/bigfile2
Then I need to remove the lines that contain the 'Permission denied' or 'find:' strings. I'm not sure if the order of the list output is relevant, but that's what I'm seeing. I'm trying several options but can not manage to remove the lines. I'm following this question, that seems similar but I don't understand why it doesn't work. https://stackoverflow.com/questions/3548453/negative-matching-using-grep-match-lines-that-do-not-contain-foo
I'm trying to ways, first with grep:
$ find data/ -size +10G | grep -v 'find:' find: `/data/badfile1': Permission denied /data/bigfile1 find: `/data/badfile2': Permission denied /data/bigfile2
Also using awk:
$ find data/ -size +10G | awk '!/find:/' find: `/data/badfile1': Permission denied find: `/data/badfile2': Permission denied /data/bigfile1 /data/bigfile2
In any case the positive selection works fine. So I don't know what to do.