[Techtalk] finding added lines in a file

Miriam English mim at miriam-english.org
Sat Aug 17 08:00:06 UTC 2013


Hi Chris,

This seems to produce exactly what I want. Thank you.
I'm going to have to spend more time reading the diff manual and playing 
with diff output though, because I don't yet understand why it works... 
and I don't like using "magical incantations". :)

Now I have a few points to start from, with everybody's suggestions. I 
should finally be able to get a handle on this.

Thank you,

	- Miriam

Chris Wilson wrote:

> In that case, try "diff -u A.txt B.txt".
>
> You can use grep to find only the added lines, and sed to remove the '+'
> signs if you want. For example:
>
>    diff -u A.txt B.txt | grep '^+' | sed -e 's/^+//'
>
> Cheers, Chris.

-- 
If you don't have any failures then you're not trying hard enough.
  - Dr. Charles Elachi, director of NASA's Jet Propulsion Laboratory
-----
Website: http://miriam-english.org
Blogs:   http://miriam-e.dreamwidth.org
          http://miriam-e.livejournal.com




More information about the Techtalk mailing list