[Techtalk] finding added lines in a file

R. Daneel Olivaw rdaneel.olivaw at gmail.com
Sat Aug 17 02:33:19 UTC 2013


Le 2013-08-16 19:34, Miriam English a écrit :
> R. Daneel Olivaw wrote:
>> diff --suppress-common-lines A.txt B.txt | egrep '<|>' | cut -c 3-
>
> This looks like it may be exactly what I want. Thanks Daneel.
> I suspect I only need "grep '>'", but I have to look more closely at the
> output of diff to be sure. And using cut is a nice touch.

Actually, Chris' solution should give something similar:

diff -u A.txt B.txt | grep '^+' | sed -e 's/^+//'

Cheers and good luck with diff ;)

R. Daneel Olivaw,
The Human Robot Inside.


More information about the Techtalk mailing list