Multiple choice technology

What is the command to find the differences in the lines containing "1999" between the files orig.txt and copy.txt, and add the result to file result.1999

  1. diff orig.txt -d copy.txt | grep 1999 > result.1999

  2. diff orig.txt copy.txt | grep 1999 >> result.1999

  3. grep 1999 *.txt >> result.1999

  4. cmp grep 1999 *.txt >> result.1999

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The diff command compares files, grep filters lines matching '1999', and >> appends to the file. Using >> (append) instead of > (overwrite) is the correct approach. Option A is wrong because -d is not a valid diff flag. Option C searches all txt files instead of comparing two specific files. Option D uses cmp incorrectly and has invalid syntax.