diff
has an option, -I regexp
, which ignores changes that just insert or delete lines that match the given regular expression. I need an analogue of this for the case, when changes are between two lines (rather than insert or delete lines).
For instance, I want to ignore all differences like between "abXd"
and "abYd"
, for given X
and Y
.
It seems diff
doesn't have any such kind of ability. Is there a suitable alternative for diff
?
sed '/regex/d' file
deletes all lines infile
where a matching ofregex
occurs. Is there a way to delete not the line but only the matching part of it? – Pickens