[Techtalk] finding added lines in a file
Little Girl
littlergirl at gmail.com
Fri Aug 16 03:10:13 UTC 2013
Hey there,
Miriam English wrote:
> Forgive my thickness. I've read (or attempted to read) the manual
> pages for diff, cmp, and comp and still can't work out how to list
> just the lines added to file B when comparing two files, A and B.
> Perhaps I can blame having just getting out of hospital after a
> bout with a mystery high fever, but I do remember having difficulty
> trying to work this out before too.
I hope you're feeling better!
> Anybody know the secret?
>
> - compare two files, A and B
> - just print the additional lines of file B
>
> It should be easy, right? I'm completely stumped.
I don't know how to do it with diff, cmp, or comp, but here it is
with comm:
comm -1 -3 <(sort A.txt) <(sort B.txt)
--
Little Girl
There is no spoon.
More information about the Techtalk
mailing list