Mattias
Mattias

Reputation: 83

Use Diff to check changed files in folder structure ignoring lines starting with pattern

Have been trying below in order to find changes to files in a Magento installation:

diff --exclude="cache" --exclude="session" --exclude="tmp" --ignore-matching-lines='\*.+' -urq /folder/modified /folder/original > diff.txt

The problem is really the ignore statement that doesn't work at all. The headers of the files in one folder contains:

* @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)

and the other

* @copyright   Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)

I would prefer to target these lines only but any comment will do really.

Upvotes: 4

Views: 525

Answers (2)

Eric Seastrand
Eric Seastrand

Reputation: 2633

In newer versions of Magento, the copyright line has changed slightly to:

* @copyright Copyright (c) 2006-2017 X.commerce, Inc. and affiliates (http://www.magento.com)

So I now use this diff command:

diff -r --exclude="var" --exclude="downloader" --ignore-matching-lines='copyright' 1.9.3.3 1.9.3.1

Tip: You can also pipe this output into colordiff to colorize it, or diffstat to summarize it.

Upvotes: 0

Gilles Quénot
Gilles Quénot

Reputation: 185434

A working solution :

diff --exclude="cache" --exclude="session" --exclude="tmp" --ignore-matching-lines='copyright *Copyright.*Magento' -urq dir1 dir2

regex simply modified.

Upvotes: 4

Related Questions